🐘
PHP & MySQL

Exporting and Importing a MySQL Database

πŸ“… 12 October 2026 ✏️ 12 October 2026 ⏱ 4 min leestijd

Learn step by step how to export and import a MySQL database via phpMyAdmin or the command line, including common issues.

Exporting and importing a MySQL database is usually done via phpMyAdmin in Plesk or via the command line with mysqldump and mysql. You export the database to a .sql file and then import that file on the destination server. In this article, you’ll read both methods step by step, including common error messages and how to resolve them.

Database A.sql fileDatabase B

Exporting a database via phpMyAdmin

phpMyAdmin is the most commonly used way to export a MySQL database, especially if you have no experience with the command line. In Plesk, you’ll find phpMyAdmin under the Databases tab for the relevant subscription.

1

Open phpMyAdmin

Log in to Plesk, go to Databases, and click phpMyAdmin next to the desired database.

2

Select the database

Click the name of the database you want to export in the left-hand menu.

3

Go to the Export tab

Choose the Quick method and SQL format, which is sufficient for most situations.

4

Click Start/Go

The .sql file will be downloaded to your computer. Store this file somewhere recognizable.

πŸ’‘ Tip: For large databases, choose the Custom method and enable compression (gzip) so the export file is smaller and uploads faster.

Importing a database via phpMyAdmin

Importing works almost the same as exporting, but in reverse. Make sure an empty database has been created on the destination server before importing.

1

Create an empty database

In Plesk, go to Databases and create a new database with an associated user.

2

Open phpMyAdmin for this database

Then click the Import tab.

3

Select the .sql file

Use Choose File to select the previously exported file from your computer.

4

Start the import

Click Start/Go and wait for phpMyAdmin to confirm that the import succeeded.

Don’t forget to update the database details (host, name, user, password) in your website or application’s configuration file after importing.

Exporting and importing via the command line

If you have SSH access, exporting and importing via the command line is often faster and more reliable, especially for large databases that can get stuck on upload limits in phpMyAdmin.

Export with the command:

mysqldump -u username -p databasename > backup.sql

Import with:

mysql -u username -p databasename < backup.sql

For both commands, you’ll be prompted for the database user’s password after execution. Make sure the destination database already exists before running the import command.

Solving common issues

When exporting and importing MySQL databases, people often run into the same obstacles.

File too large to upload: phpMyAdmin has a maximum upload size. In that case, use the command line, split the file, or compress it as gzip.

Timeout during import: Large databases can exceed phpMyAdmin’s execution time. Import via SSH with mysqldump or temporarily increase the PHP settings in Plesk.

Character encoding error: Check that both the source and destination databases use the same collation (for example, utf8mb4) to prevent strange characters.

Access denied: Check that the database user has sufficient permissions on the destination database; you can set this in Plesk under database users.

If you get stuck while migrating a website including its database, for example when switching to Tandata, check the knowledge base or contact support. For a website with associated web hosting and business email, the team is happy to help with the switch.

Frequently asked questions

What’s the difference between mysqldump and exporting via phpMyAdmin?

Both methods generate the same kind of .sql file. mysqldump via the command line is usually faster and more reliable for large databases, while phpMyAdmin is more convenient for smaller databases without SSH access.

Can I import a database that already contains data?

Yes, but existing tables with the same name may conflict or be overwritten. It’s best to start with an empty database to avoid unexpected issues.

How large can a .sql file be to import?

This depends on the server settings for upload size and execution time. For large files, importing via the command line is almost always the better option.

What should I do if the import stops halfway through?

Check the error message: it’s often a timeout, memory limit, or a syntax error in the file. Import via SSH to work around these limits.

Do I need to adjust anything after importing?

Yes, update the database details (host, name, user, password) in your website or application’s configuration file so it connects to the new database.

Conclusion

Exporting and importing a MySQL database is easy with phpMyAdmin for smaller databases, while the command line with mysqldump and mysql works better for large databases or when you run into limits. Always ensure an empty destination database and check your website’s configuration after importing.

View web hosting β†’

Was dit artikel nuttig?