WP-CLI is a powerful command line utility for WordPress, which is included by default with your hosting plan or server. It can be used to perform many of the actions you would normally complete in the WordPress dashboard, such as installing or updating plugins and themes, managing users, making changes to the site configuration, and much more.
Here we cover the steps to export a database using WP-CLI. This can be useful as a means of creating a backup of the database, migrating the site to another server, or cloning the site to another domain.
Related Articles
Export Database Using mysqldump
Export MySQL Database Using phpMyAdmin
SSH into Shared Server
How to SSH into VPS or Dedicated Servers
Find the Document Root of a Domain
Export Database
- Access the server via SSH or using the Terminal in cPanel
- Navigate to the site's document root using the cd command
cd public_html
REPLACE: public_html with your domain's document root if different. - Run the following command to export the database
wp db export
NOTE: As a best security practice, it is recommended to move the SQL file outside of the site's document root. The following command will move the file to the user's home directory (e.g. /home/userna5/).mv database_name.sql ~
REPLACE: database_name.sql with the name of the file generated when you ran the export command.
Comments
0 comments
Article is closed for comments.