This one has been on my draft for more than a year already so I better fix it up and share. Besides, I find myself more and more googling my site to find my posts instead of searching via the WP admin. Without further ado, here it is..

MySQL Dump
This command saves/backup your database into a file. The simplest use of this is to backup the whole database.

mysqldump -u<db_user_id> -p <db_name> > <path/filename.sql>

Of course, there’s a whole set of options that comes with it but I’ll not cover that for now.

mysqldump -uroot -p wp_dbase > /usr/kwatog/wpdb_20100813.sql

Take note that you’ll be asked for password when you launch this command.

Reload MySQL Backup to DB
In case you want to reload your backup, here’s the syntax for it.

mysql -u<dbuserid> -p <dbase_name> < <path/filename>

Sample

mysql -uroot -p wp_dbase < /usr/kwatog/wpdb_20100813.sql

Again, it’s so easy, no?

Comments are closed.

Post Navigation