Monday, August 27, 2007

simple mysql backup or transfer

sometimes we need to backup a database or transport a database from one server to another. the situations are not always good. you are stranded with no phpmyadmin help. mysql provide mysqldump to help you in non-gui environment. just do:

% mysqldump [name_of_the_database] -u [username] -p > [name_of_the_database].sql

as example,

% mysqldump krs -u krs_user -p > krs.sql

the process is finish in few minutes depends on the size of the databases. here you are the backup process is finish. to transport to other server, just copy the krs.sql to the directed server, than do:

% mysql krs < krs.sql -u krs_user -p

or see my previous post about mysql.

No comments: