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.
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.
When using terminal for exporting a database you have to do is 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 FileZila.
Give us your feedback on this article
Did this help you?
We have launched in the UK! 🇬🇧
Servebolt Cloud UK is now available to all clients. Our London data center will ensure that all clients with their majority of visitors in the UK experience extremely fast websites!