Scripting

Copying One mySQL database from one machine to another

# mysqldump -h host.com -u root -p password sourceDB | mysql -h host2.com -u username -p password -C targetDB Interestingly, you don’t actually have be on the ‘source’ machine thanks to mySQL’s -h switch. From the target machine, simply specify the remote host after the -h. This was quite useful for me as my source […]

Read More
Scripting

mySQL and Stored Triggers

This is an example on how you an use stored triggers in mySQL /* test_workaround.sql */ USE test ; DROP TABLE IF EXISTS `addresses`; CREATE TABLE `addresses` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `created_on` DATETIME NOT NULL DEFAULT ‘0000-00-00 00:00:00’, `updated_on` DATETIME NOT NULL DEFAULT ‘0000-00-00 00:00:00′, `mac_address` CHAR(17) NOT NULL DEFAULT ’00:16:DD:xx:xx:xx’, /* […]

Read More