1. Using your web browser, browse to the PHPMyAdmin location of the server where the database you wish to import resides. For example: http://www.example.com/phpmyadmin/ for a remote database and http://localhost/phpmyadmin/ for a database hosted on your Apache2 installation.
  2. Here you will either need to select an existing database name in the combo box on the left side of the PHPMyAdmin page, or create a new one. Note that if you are setting up a database on a remotely hosted site, your host may have prohibitions on the creation of MySQL databases that require they be created outside of PHPMyAdmin by means of a control panel or other mechanism; check with your web hosting service for specific details of their requirements.
  3. Once you have selected or created the appropriate database name, select the tab labeled "Import" on the PHPMyAdmin page to be taken to the import page.
  4. Find the control group in the Import page form labeled "Location of the text file" and click the button labeled "Browse", following the resulting dialogs to select the database file of your choice.
  5. IMPORTANT

    If you are importing a database that you exported using the instructions in this tutorial, remember, the tables of the imported database will overwrite any that exist in the database you are importing to, overwriting them. Therefore it is important to double-check that the database you are selecting and the target you are importing to are correct before proceeding. If uncertain, you should back up the target database before importing a new one into it.

  6. Click the button labeled "Go" to import your new database.

Known issue for PhpMyAdmin GUI

PHPMyAdmin has a known issue for importing a large size database. You need to use the command line tool to import a large database.

What to do if import fails - Alternate command-line import

If the import fails (maybe because of charset differences, or because it was exported using MySQLDump), you can try to import it via the command line:

  1. SSH to the source unix machine and run the following command :
    mysqldump -u sourceDbUser -pPassword sourceDbName > db.dmp
  2. Open a CMD command-line window on the target Windows machine and run the following command:
    mysql -u root -pYourApache2TriadRootPassword newDbName < db.dmp

mysqldump export to phpMyAdmin import - error

phpMyAdmin can have trouble processing the conditional comment lines of mysqldump. If you export your database using mysqldump you may receive the following error upon import:

-- MySQL dump 10.10
--
-- Host: localhost Database: databaseNameHere
-- ------------------------------------------------------
-- Server version 5.0.19-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;

MySQL said: Documentation
#1065 - Query was empty

Then try this mysqldump command:

mysqldump -uroot -proot --compact --quick databaseNameHere > databaseNameHere.sql

This is useful for making hourly backups of your database via crontab which can be imported by your developers via phpMyAdmin.

Comments

Jooblay.net’s picture

JUST A NOTE FOR ANYONE THAT WANTED TO ACTUALLY KNOW WHAT THE STRUCTURE TERM DEFINITIONS ARE:

I pulled this off the above page of which this post is titled.
Structure:

"Add DROP TABLE" will add a line telling MySQL to drop the table, if it already exists during the import. It does NOT drop the table after your export, it only affects the import file.
"If Not Exists" will only create the table if it doesn't exist. Otherwise, you may get an error if the table name exists but has a different structure.
"Add AUTO_INCREMENT value" ensures that AUTO_INCREMENT value (if any) will be included in backup.
"Enclose table and column names with backquotes" ensures that column and table names formed with special characters are protected.
"Add into comments" includes column comments, relations, and MIME types set in the pmadb in the dump as SQL comments (/* xxx */).

Data:

"Complete inserts" adds the column names on every INSERT command, for better documentation (but resulting file is bigger).
"Extended inserts" provides a shorter dump file by using only once the INSERT verb and the table name.
"Delayed inserts" are best explained in the MySQL manual.
"Ignore inserts" treats errors as a warning instead. Again, more info is provided in the MySQL manual, but basically with this selected, invalid values are adjusted and inserted rather than causing the entire statement to fail.

;/ knowledge more definitions are stated here in the php documentation: http://www.phpmyadmin.net/documentation/

nilashis’s picture

D6 - I just imported a large (208MB) database to my Localhost Drupal6 Installation. Right out of the box, the database import was not working so I had to follow a couple of steps. Wanted to put it down here if anybody else runs into the same problem;

Changed php.ini at C:\wamp\bin\php\php5.4.3
max_execution_time = 600
max_input_time = 600
memory_limit = 1024M
post_max_size = 1024M

Changed my.ini at C:\wamp\bin\mysql\mysql5.5.24
max_allowed_packet = 1024M
Reference Thread: http://drupal.org/node/715636