Exporting a MySQL is vital for easy backup of important files and information within the database. When you export a database, you can import it into another database server to access the queried data.
Exporting a MySQL database from your account can be done in two ways:
- Via phpMyAdmin Tool
- Via SSH
In this article, we are going to discuss the step-by-step process of both methods.
Ready? Let’s get to it!
Export MySQL Database using phpMyAdmin Tool
PhpMyAdmin tool is a MySQL application that helps to carry out several database management activities. With phpMyAdmin, you can:
- Create
- Drop
- Delete
- Import
- export MySQL database tables.
In this section, we are going to show you how to export databases using the phpMyAdmin tool. You can use this method when dealing with smaller-sized files or files that are less than 128MB.
To export MySQL Database using phpMyAdmin Tool, follow these steps:
Login into your cPanel Account
Scroll to the Databases section and select the phpMyAdmin tab
In the phpMyAdmin area, the tool will display a list of all the existing databases. Select the database you wish to export.
When the database is open, it will display a set of options on the screen’s upper part. Select the Export option.
Select your preferred export method. If you are unsure about what option to select, leave it at the default option chosen
Click on the Go button to start the download process.
This process will export your database file to your local computer successfully.
Export MySQL Database using SSH
SSH stands for Secure Shell. It’s a network protocol that established a secure connection between a client and a server. You can use it to connect to your database and export the data from it to an SQL file saved on your server. However, you need to bear in mind that SSH is only available via the Command-Line Interface, so you need to be a bit more comfortable working with commands.
After logging into the server via SSH successfully, you need to execute a command that looks like this:
$ mysqldump -p -u [your_user] [your_database] > [filename].sql
So, if you have a MySQL user called test_user that has access to a database called test_wp908040 and you want to export the data to export.sql, the command will look like this:
After you enter the password, MySQL will export the entire database and will save it to export.sql. If you want to retrieve the file, you can do it via FTP.
You can also use SSH to export a MySQL Database when working with files that are larger than 128MB.