One of the most critical parts of your WordPress installation is the database. Every smart admin will backup their database on at least weekly basis or even more often depending on the website change dynamic.
We saw in previous articles how WP-CLI can facilitate Wordp ress administration and make us more efficient when dealing with WordPress.
Let us go ahead and see how we can automate database backups with the help of WP-CLI.
How to backup your WordPress Database with wp-cli
aodba451@sgp25 [~/www]# wp db export
Success: Exported to 'aodba451_wordpress.sql'.
Note: – this will backup the database in a .sql format
This is very efficient and you do not have to create separate mysqldump backup strategies or new scripts for you to develop and manage.