How to import a database using phpMyAdmin
This article will show you how you can import a database from a file on your local computer to your Krystal cPanel account. This article assumes that you are already successfully logged into cPanel.
We have a separate article on importing large databases - which may time-out or error when importing through phpMyAdmin.
- Create a database if you have not already done so.
Before you can import a database dump file from your computer, a destination database must already exist within your cPanel account. Please see the article How to create MySQL databases in cPanel.
- Open the phpMyAdmin web application.Open the phpMyAdmin web application by clicking on the phpMyAdmin icon in the Databases section of cPanel.
- Select your database.
Once phpMyAdmin opens, you will see down the left margin a list of databases to which you have access. information_schema is a special database that holds information "about" your databases - you do not need to access this.
Click on the name of the database you want to import your data into - in the below case, krystald_testing.
- View Import settings.
Click on the Import tab.
- Import your data.
Click the Choose File button and browse your computer for your MySQL dump file (usually named *.sql)
That's it - the default options will normally work fine for you. Just click the Go button!
- Any Errors?
A common error that occurs looks like the one shown below. This is because your database dump file contained instructions to create a specific database name. This is not allowed, because we are importing data into a known (predefined) database. To prevent this error recuring you must comment out or remove the lines that are highlighted (in this case, remove the line that reads CREATE DATABASE etc..)