Webhosting – Export/Import Database in phpMyAdmin

  Web Hosting

This guide describes database administration using the phpMyAdmin tool.

Log in with the database login name and password.

In this article, you will learn:

Database Export

When you export a database, you download the current data that is in it. Most commonly, you export databases as a part of manual backups.

Follow these steps to export the database:

  1. Log into the phpMyAdmin interface with the database admin account.
  2. In the left menu, select the database from the dropdown menu.
  3. In the top menu, click the Export tab.
  4. Keep the default settings – Export Method: Quick and Format: SQL.
  5. Click the Go button.
  6. Save (download) the exported *.sql file.
PMA Quick database tables export
Quick database tables export

Import into Database

You can import the exported file into the database again, for example when restoring a backup.

You can only import files containing database tables. The system will reject files with multiple databases or unsupported commands. For more information about import errors, see the Common Issues chapter.

Follow these steps to import tables into the database:

  1. Log into the phpMyAdmin interface with the database admin account.
  2. In the left menu, select the database from the dropdown menu.
  3. In the top menu, click the Import tab.
  4. Click the Upload File button and choose an *.sql file to import.
  5. Click Go.
PMA Importing into a database
Importing into a database

Uploading the file may take some time – it mainly depends on the data volume and connection speed. The system will inform you when the import is complete.

Common Issues

Most of the time, the database export runs smoothly, but you may encounter the following errors during import:

#1044 Access denied

Issue: There is an error: #1044 Access denied for user ‘X’@’%’ to database ‘dXXXXXX_database’.

Cause: You will most often encounter this error when importing our data backup into a database with a different name, or when importing a database from another provider.

PMA Denial of access due to mismatched database user and name
Denial of access due to mismatched database user and name

Solution: First, check that you are actually uploading data to the correct database. If so, proceed with these steps:

  1. Open the SQL data file in any text editor (such as Notepad).
  2. Find the rows starting CREATE DATABASE and USE.
  3. Disable these commands by placing the characters ‐‐ at the beginning of these rows.
  4. Save the SQL file and try importing again.
Sample altered code of a database restored from backup
Sample altered code of a database restored from backup

#1046 No database selected

Issue: There is an error #1046 No database selected.

Cause: This common issue arises when you click Import without first selecting a database.

WGP Select a database to correct the "No database selected" error
Select a database to correct the “No database selected” error

Solution: In the left column, select the database to which you want to import, and perform the import again.

#1062 Duplicate entry

Issue: There is an error: #1062 Duplicate entry ‘X’ for key PRIMARY.

Cause: If you import data that is similar to what is already in the database, you may encounter an error that prevents PMA from overwriting the data.

Solution: If you are sure that you no longer need the old data, delete it, and import again.

#1142 CREATE command denied

Issue: There is an error: #1142 – CREATE command denied to user ‘wXXXXXX_database’@’X.X.X.X’ for table ‘table_name’.

Cause: This error occurs if you log in as the web database user (wXXXXXX_….).

PMA Error for command with insufficient permissions
Error for command with insufficient permissions

Solution: Log in as an administrator database user (aXXXXXX_….), and perform the import again. You can find the login info in the database creation email, or you can update it in the customer administration panel according to the guide Webhosting – Databases.

FAQ

Question: I encountered an error that isn’t mentioned in the article, what should I do?
Answer: Take a screenshot and send it to us via the form. Include the name of the webhosting and database.

Question: I have a database restored from your backup, and I am afraid that I will mess something up with the import. Can you import it for me?
Answer: Yes, send an authorized request (from the account containing the Webhosting in question) via the contact form. Please note that database imports have one of the lowest priorities of all technical requests, so it may take hours, and in some cases even days, to complete.

Děkujeme za zpětnou vazbu!