Backup WordPress Database using MySQL Command

Last Updated on June 3rd, 2016
0
639
backup Wordpress Database using mysql command

Backup WordPress Database is necessary for every developer, webmaster or blogger. Database Backup is required before making any necessary changes in your database as per your website requirements. If any mysql query goes wrong in your database, it will impact your website. So at that time you can restore database backup.

There are various backup plugin for wordpress websites to backup the whole site in just few steps. Find one of the best plugin My WP Backup it contains all the best feature which every webmaster or administrator wants for their site.

There are two ways to take WordPress database backup.
1st WordPress Database Backup using myphpadmin
2nd Backup WordPress Database using MySQL Command

This article will help you to take wordpress database backup using MySQL Commands. All you have to do is follow the steps below.

1) Select the directory you want to dumb your all your data files

user@linux:-> cd files/blog

2) mysqldump is the MySQL command syntax to dump (backup) all your database tables. To select certain tables from the database, you need to use command as mentioned below as (tablename tablename tablename) and you can omit the parenthesis (). (for more details how to use mysqldump TRY: man mysqldump)

user@linux:~/files/blog> mysqldump --add-drop-table -h mysqlhostserver
-u mysqlusername -p databasename (tablename tablename tablename) | bzip2
-c > blog.bak.sql.bz2
Enter password: (enter your mysql password)
user@linux~/files/blog>

bzip2 -c means that backup is compressed and put the file with the output file name blog.bak.sql.bz2

bzip2 is the best effective way to compress the files rather than older methods like .Z, .zip, .gz, it is also considered as the slower method. In case your database is larger then you can use .gzip method for faster process.

mysqldump --add-drop-table -h db01.example.net -u dbocodex -p dbwp | gzip > blog.bak.sql.gz

Note: Please use man mqldump before using above commands

LEAVE A REPLY