Here we explain a command used to quickly create a MySQL database dump. This process involves using the command line as the root user on a VPS or Dedicated server. This will allow you to back up a sites database from the command line in the directory you are currently working in.
Related Articles
Export Database Using mysqldump
Export WordPress Database using WP-CLI
Export MySQL Database Using phpMyAdmin
Create Site Database Backup
IMPORTANT: This solution will require root access. If this needs to be obtained, follow the guide on requesting root access.
- SSH into the relevant server as root
- Switch to the directory that you wish to dump the database into
EXAMPLE:cd /home/userna5
REPLACE: Use an actual cPanel username instead of userna5 in the example above. Or, choose another directory if you wish to do so. - Run the following code, which will ask for the name of the database and create a MySQL dump in your current working directory
Note: If needed, follow the guide on finding a WordPress sites database name.
read -p "What is the database name?: " dbname; mysqldump -Q --add-drop-table "$dbname" > "$dbname-$(date -I).sql"
Comments
0 comments
Article is closed for comments.