There are two ways to export a database. You can either use phpMyAdmin or SSH commands. If you are not familiar with terminal commands we recommend you stick to the phpMyAdmin way.
Exporting Databases Through PhpMyAdmin
Before exporting make sure you are on the correct database, and not information_schema. When you have clicked on the database you want to export you can easily go to the export tab and click finish. This will save the database dump locally on your computer.
Exporting Databases with Command Line Tools
For exporting your database through terminal, you need to access the server through SSH. Once you have accessed the server you insert your information into this command:
mysqldump --single-transaction -u USERNAME -p DATABASENAME > FILENAME.sql
Or if you have a WordPress site you can use this CLI command in your WordPress directory (normally ~/public/):
wp db export
If you want to go a step further to gzip your sql file you can run this command:
mysqldump --single-transaction -u USERNAME -p DATABASENAME | gzip > db_dump.sql.gz
To extract your gzipped sql file you can run this command:
After filling in your information, you are asked to enter the database password. After filling in the correct password, the server will process the information and create a database dump in your current directory.
If you want to transfer this database dump to you local machine or to another server, you can do this through the
rsync command or through FileZilla.
Give us your feedback on this article
Did this help you?
Servebolt has launched Accelerated Domains!
Accelerated Domains is a service that greatly improves and optimizes your site on these four areas: Performance, Scalability, Security and the Carbon footprint of your website.