Importing your Databases

There are multiple ways to import a database. In this article we will use phpMyAdmin and shell commands. If you are not familiar with the terminal and shell commands we recommend you stick to phpMyAdmin.

If you wonder how to export databases, please check out this article.

Importing Databases with phpMyAdmin

To import your database through phpMyAdmin, you first have to login to phpMyAdmin. Before importing your database, make sure you are on the correct database, and not information_schema. When you have clicked on the database you want to import to, click choose file and select a .sql file either raw or compressed which you have saved locally. Click go and you should see a success screen.

Importing Databases with mysql

When using terminal for importing a database all you have to do is upload the database dump to the server using rsync, scp or with a FTP program like FileZilla. Once the file is located on the server you can run the following command (replace USERNAME, DATABASENAME and FILENAME):


If you have a compressed .sql file you can decompress it and pipe the output into mysql in one go. Here’s an example with gunzip which decompresses gzip formatet files. By passing the -c flag we also outputs the decompressed file:

gunzip -c FILENAME.sql | mysql -u USERNAME -p DATABASENAME

When hitting enter, you are asked to pass the database password. After filling in the correct password, the server will do the rest. 

Importing Databases with WP-CLI

If you have a WordPress site you can use the WP-CLI command line extension. WP-CLI is quite a bit easier than using mysql because it will fetch the database credentials for you. Simply run wp db import FILENAME.sql in your main WordPress directory and it will do the rest for you. FILENAME.sql is your uploaded database dump. Be sure to add the --path= parameter if you run the command outside that directory.

And as always, should you have any additional questions please don’t hesitate to contact our support chat at!

Give us your feedback on this article