One tool I’ve been using for several months is WP-CLI. This tool is an absolute must if you are doing any server work. WP-CLI from their website, is a command-line tool for managing WordPress installations. It gives you the abilities like update plugins, themes, even WordPress. You can even do database tasks.
The database tasks are probably the most important for me. This is pretty sweet because you could create a system that would provide backups of your database very easily. Let’s take a look at what it would look like.
First off, if you wanted to do a backup of a database it would look something like this with MySQL commands:
mysqldump -u<username> -p<password> database > /file/location/filename.sql
This should look familiar to most people. But we’ll break it down right now. The first, mysqldump. This is the command that tells mysql you want a dump of a databse. The options -u and -p are pretty simple, you want to pass the username and passwords. Then we add the database we’d like to get the backup from, and finally we add in the file location and filename of the sql file we’d like to create.
With WP-CLI though, we could do something else.