How to Import and Export a MySQL Database Using phpMyAdmin

phpMyAdmin allows you to export a MySQL database as a backup file and import a database backup when needed.

This is useful when moving a website, restoring a database, or keeping a manual copy of your website database.

This guide explains how to export and import a MySQL database using phpMyAdmin from DirectAdmin.


Before You Start

Before making changes to a database, please make sure you know which database belongs to your website or application.

Importing the wrong database file into the wrong database may overwrite existing data.

If you are unsure, contact HostworX Support before continuing.


Step 1 – Log Into DirectAdmin

Open your browser and visit: https://cp.yourdomain.co.za (Replace yourdomain.co.za with your own domain name.)

Enter your DirectAdmin username and password.

Click: Log In


Step 2 – Open phpMyAdmin

Once you are logged into DirectAdmin, open phpMyAdmin.

Click: Account Manager

Then click: phpMyAdmin

DirectAdmin may open phpMyAdmin in a new browser tab.


Step 3 – Select Your Database

In phpMyAdmin, look at the left-hand side of the screen.

Click: Your database name

Make sure you select the full database, not only one table inside the database.

You should see a list of tables after selecting the database.


How to Export a MySQL Database

Exporting a database downloads a copy of the database to your computer.

This can be used as a manual backup or for moving a website to another hosting account.


Step 1 – Open the Export Tool

After selecting your database, click: Export


Step 2 – Choose the Export Method

For most users, the default export option is usually suitable.

Locate: Export method

Select: Quick

Locate: Format

Select: SQL

Click: Export

Your browser will download the database backup file to your computer.

The file will usually end with:

.sql


Advanced Export Option

If you need more control over the export, you can use the custom export option.

Locate: Export method

Select: Custom

Make sure the correct database tables are selected.

Locate: Format

Select: SQL

You can then download the database using the available export options.

For most normal website backups, the Quick export option is usually enough.


How to Import a MySQL Database

Importing a database uploads a database backup file into phpMyAdmin.

This is commonly used when restoring a database or moving a website.

Important: importing a database may replace or add data inside the selected database.


Step 1 – Select the Database

In phpMyAdmin, look at the left-hand side of the screen.

Click: Your database name

Make sure you select the database where you want to import the backup.


Step 2 – Open the Import Tool

Click: Import


Step 3 – Choose the Backup File

Locate: File to import

Click: Choose File

Select the database backup file from your computer.

The file will usually end with:

.sql

Some database backups may also be compressed, for example:

.sql.zip

.sql.gz


Step 4 – Start the Import

After selecting the file, scroll down to the bottom of the page.

Click: Import

phpMyAdmin will begin importing the database.

If the import is successful, phpMyAdmin will show a success message.


Common Import Problems

You may experience an error if:

  • The database backup file is too large.
  • The backup file is damaged or incomplete.
  • The wrong database was selected.
  • The database already contains conflicting tables.
  • The website uses a different database name, username, or password.

If you receive an error, do not keep trying repeatedly without checking the cause first.

Contact HostworX Support and include the error message shown in phpMyAdmin.


Important Notes

Please keep the following in mind:

  • Always confirm that you have selected the correct database.
  • Exporting a database does not remove it from the server.
  • Importing a database can change or overwrite existing database content.
  • Keep a copy of your original backup file safe.
  • Large database imports may need to be handled by HostworX Support.

Conclusion

phpMyAdmin makes it possible to export and import MySQL databases directly from DirectAdmin.

Exporting is useful for creating a manual database backup, while importing is useful when restoring or moving a website database.

Always be careful when importing a database, as it can affect the live website connected to that database.

  • database backups, directadmin databases, mysql databases, phpmyadmin, database import export
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How to Access phpMyAdmin in DirectAdmin

phpMyAdmin is a web-based database management tool included with many hosting accounts. It...

How to Change a MySQL Database Character Set and Collation in phpMyAdmin

A MySQL database character set controls which characters can be stored in the database. A...

How to Check Which Database Your WordPress Website Uses

A WordPress website stores most of its content and settings in a MySQL database. If you need to...

How to Create a MySQL Database in DirectAdmin

Many websites and applications require a MySQL database to store information such as website...

What Is a Database User?

A database user is a login account that allows a website or application to connect to a MySQL...