Import database in phpMyAdmin
Added: 10.03.2014 23:26:29 Last updated: 13.01.2017 14:38:12
This guide details how to import a database in phpMyAdmin. To import a database you must export the database you want to import. The guide Export of database in phpMyAdmin details this.
Before we can import the database, we must know the following:
- DBMS for exported database
We must know which DBMS (Database management system - like MySQL) was used on the server the database was exported from. If you have exported via phpMyAdmin, which DBMS was used will be listed at the top of the file like in the example below:
-- phpMyAdmin SQL DumpIn this case, MySQL 5.5.42 was used. Step 2 pt. 1 of Export of database in phpMyAdmin also show the same. If you are unsure, you can ask the provider of the server you exported the database from.
-- version 220.127.116.11
-- Host: localhost
-- Generated: 28. Sep, 2015 10:09 AM
-- Server version: 5.5.42
-- PHP version: 5.4.31
- DBMS compatibility
We must know if the database was exported to be compatibel with a specific DBMS. If that's the case, point 1 can be ignored. The person who exported the database will know if it was exported for a specific DBMS when this is chosen during export. It is not easy figuring this out in the aftermath. Step 5 pt. 6 of Export database in phpMyAdmin shows how compatibility is chosen during export in phpMyAdmin.
- Charset for exported file
We must know which charset the file that contains the export of the database is using. If you specify the wrong charset when importing, will characters like æøå not be shown correctly on the websites after the database has been imported. "utf8" is standard when exporting in phpMyAdmin. If "utf8" doesn't work like desired, you should try "latin1".
Click on the icon for "phpMyAdmin" as shown in the screenshot below in cPanel:
- Notice which version of MySQL is being run on the server you are importing the database to, since this is relevant in regards to pt. 1 og 2 in step 1.
- Click on the database you want to import the database to in the list of databases. In this case it will be the database "exampque_wp380"
- Click on "Import"
- Click on "Browse" to pick the file you want to import.
- Choose charset for the file. See step 1 pt. 3.
- Choose which format the file has. Unless you have been given instructions to do otherwise, you pick "SQL" here.
- Choose SQL compatibility for the file. See step 1 pt. 1 and 2. Usually, "NONE" will be the correct choice.
- Click "Perform".
- When the import is done, you will see a confirmation, like in the picture below. If there is something wrong, this is where you will be notified.
- The imported tables in the database can be seen in the left column in phpMyAdmin.
We have now been through how to import a database in phpMyAdmin.