How do I import a MySQL Database?

As with exporting your database to another server, importing it too is vital to keep your website up and running without any hassles. As a prerequisite, you will have to have already created a new database with all the necessary database structures included, so as to make the import process smoother. This can be done using phpAdmin from cPanel. In another method, you can import databases through command line (SSH).

Importing Databases via phpMyAdmin

1. Log in to your cPanel account.

2. Navigate to Databases.

The Database section will be displayed.

import a MySQL Database

3. Click phpMyAdmin Databases.

The phpMyAdmin Databases page will be displayed.

You will find the list of available databases.

list of available databases

4. Click Import.

5. Click Choose File and select the file in .SQL or .ZIP format from your computer.

6. Select the Format as SQL from the drop down list.

7. Click Go.

Importing Databases via Command Line (SSH)

You can also import the database using your SSH login credentials. In this case, your database file must be in SQL format only.

  1. Using cPanel’s File Manager, or FTP client, upload the database to home directory.
  2. If the database is not available, create a new database, a user, and give the user full privileges to the database.
  3. Log into your server via SSH.
  4. Use the Importing Databases via Command Linecommand to verify that the file is in your current directory.
  5. In the following command, replace the 'user_name', 'database_name, and 'file.sql' with the correct values for your database and file:
  6. mysql -p -u user_namedatabase_name
  7. Enter the database user password.

Note: If the file is not present, upload/move the file to the correct directory, or navigate to the directory where the file is located.

Your database will be imported.


How can we help you?

We want you to ask us questions, because we love to help you in accomplishing your goals. We let no questions unanswered, provide you with high speed responses and leave no problem unsolved. What is important to you, is important to us. Shoot us a message and see for yourself.