CS · EN

Webhosting - Import and Export Databases in phpMyAdmin

This guide describes database management using the administrative tool phpMyAdmin ⧉. Log in with the database login name and password.

In this guide, you will learn:


Exporting a database

When exporting a database, you download the current data stored in it. Export is useful, for example, for manual backup.

Export the database by following these steps:

  1. Log in to phpMyAdmin ⧉ using the administrative account of the database you want to export.
  2. In the left menu, select the database from the drop-down list.
  3. In the top menu, select the Export tab.
  4. Leave the Export method: Quick and Format: SQL settings unchanged.
  5. Click the Go button.
  6. Save (download) the exported *.sql file.
Quick export of tables from the database
Quick export of tables from the database

Importing into a database

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

You can only import files containing database tables. Files with multiple databases or unsupported commands will be rejected by the system. More information about import errors can be found in the Common issues section.

Import into the database by following these steps:

  1. Log in to phpMyAdmin ⧉ using the administrative account of the database where you want to import the data.
  2. In the left menu, select the database from the drop-down list.
  3. In the top menu, select the Import tab.
  4. Click the Choose file button and select the *.sql file you want to import.
  5. Click the Go button.
Importing data into the database
Importing data into the database

Uploading the file may take some time — it depends mainly on the amount of data and the speed of the connection. After the import is complete, the system will inform you.

Message about successful import
Message about successful import

Common issues

Database export usually completes without problems, but during import you may encounter these errors:

#1044 Access denied

Problem: The error message #1044 Access denied for user ‚X’@’%‘ to database ‚dXXXXXX_databáze‘. is displayed.

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.

Access denied message when uploading a backup to another database
Access denied message when uploading a backup to another database

Solution: First check whether you are really uploading the data to the correct database. If so, continue with these steps:

  1. Open the SQL file with the data in any text editor.
  2. Find the lines starting with CREATE DATABASE and USE.
  3. Disable these lines by placing ‐‐ at the beginning of the line.
  4. Save the SQL file and try importing again.
Example of excluding problematic code in an SQL backup file
Example of excluding problematic code in an SQL backup file

#1046 No database selected

Problem: The error message #1046 No database selected. is displayed.

Cause: This common error means that you did not select a database before importing.

No database selected message and the solution by selecting a database in the left column
No database selected message and the solution by selecting a database in the left column

Solution: Select the database you want to import into in the left column and perform the import again.

#1062 Duplicate entry

Problem: The error message #1062 Duplicate entry ‚X‘ for key PRIMARY. is displayed.

Cause: If you import data similar to data already present in the database, an error may occur in which PMA prevents overwriting the data.

Error when attempting to overwrite existing data
Error when attempting to overwrite existing data

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

#1142 CREATE command denied

Problem: The error message #1142 – CREATE command denied to user ‚wXXXXXX_databáze’@’X.X.X.X‘ for table ‚název_tabulky‘ is displayed.

Cause: You will encounter this error if you are logged in as a web user, i.e. wXXXXXX_….

Command error for a user with insufficient permissions
Command error for a user with insufficient permissions

Solution: Log in as a user with administrative privileges (aXXXXXX_…) and perform the import again. You can find the login details in the service setup email, or according to the guide Webhosting - Databases.


Frequently asked questions

I encountered an error while trying to import that is not described in the guide. What should I do?

Take a screenshot ⧉ of the error message and send it to us via the form ⧉ together with the name of the web hosting service.