Procbits

source code snippets and other random musings about software

Archive for April, 2009

Convert InnoDB Tables to MyISAM

Posted by JP on April 7, 2009

I have been trying to optimize my 256 MB slice from slicehost. One of the strategies is to not use the InnoDB SQL engine for your tables and instead use MyISAM. If you need transactions or foreign key support you should not do this.

I came across this snippet:

SELECT CONCAT('ALTER TABLE ',table_schema,'.',table_name,' engine=MyISAM;') FROM information_schema.tables WHERE engine = 'InnoDB';

It seems to have worked. Maybe I’ll provide an article or tutorial in the future on benchmarking your slice.

-JP

Posted in MySql, Slicehost | Leave a Comment »

Backup a MySQL Database on Ubuntu

Posted by JP on April 7, 2009

Backing up a MySQL database is extremely simple. Just simply create a directory as to where you want to store your backups. I typically just dump them in /var/dbbak. You can then run the following command:

/usr/bin/mysqldump -u root -p YOUR_DB_NAME | gzip > /root/dbbak/YOUR_DB_NAME_`date +%y_%m_%d`.gz

-JP

Posted in Linux, MySql, ubuntu | Leave a Comment »