Tuesday, May 8, 2012

Mysql: Dump & Restore Database

Mysql Dump Syntax/Command

We use mysqldump command to do database backup

# mysqldump -uroot -p --databases filename > backupname.sql

eg: mysqldump -uroot -p --databases staff > staff130509.sql

Then, to dump back/restore the backup database to server, use this command:

#mysql -uroot -p < staff130509.sql

But, for UTF8 case, use this command:

#mysql -uroot -p --default-character-set=utf8 < staff130509.sql

Then to check the current process list in mysql server:

#mysql -uroot -pPASSWORD
mysql> show processlist;


To show processlist with out all the sleeping processes...
mysql> \P grep -v Sleep




1 comments:

Unknown said...
This comment has been removed by a blog administrator.

Post a Comment