How to Import and Export MySQL Database using phpMyAdmin

In this tutorial, you will learn how to import and export the MySQL database step by step using phpMyAdmin.

This tutorial will be extremely helpful for you if you’re working with MySQL databases. And if you’re a WordPress user then after reading this guide you can manually create backups of your MySQL database. You can also migrate the database from one server to another.

For your convenience, we have divided this tutorial into two steps. In the first step, we’ll export a MySQL database. And then in the second step, we’ll import that database using phpMyAdmin.

If you’re a beginner then you might be wondering what is phpMyAdmin. Then, let’s see the short introduction.

What is phpMyAdmin?

The phpMyAdmin is a free database administration tool. We use it to create, edit, and manipulate MySQL databases. It is a very easy-to-use tool with all the features that you need to manage MySQL databases. And most importantly you can use it without having any knowledge of SQL.

This is the easiest and most suitable tool that allows us to work with MySQL databases.

Prerequisites

Before going to export and import a database:

  1. You must have a MySQL database already created. If you don’t have a MySQL database created then see this complete guide to create a MySQL database using phpMyAdmin on your local computer.
  2. If you have a MySQL database on the live server that is somewhere else. Then you can access phpMyAdmin from there site or dashboard. And if you are using localhost then just make sure XAMPP is running on your computer so you can access phpMyAdmin on your pc.

Now, let’s begin with our first step.

How to Export a MySQL Database Using phpMyAdmin

To do this,

  1. First of all, go and log in to phpMyAdmin to access your database.

Note: If you’re using live hosting then go to your hosting dashboard and log in from there. And if you’re using localhost XAMPP then you can access it by just typing localhost/phpMyAdmin in your browser.

2. After logging in, as you can see in the below image your databases will be listed on the left side. Just select the database that you want to export by clicking on the database name as shown below.

select your MySQL database to Export

3. Now, click on the export button as shown below.

click export MySQL database

4. After that, click on the ‘Go’ button and your database will start downloading. Just make sure SQL is selected as shown below so that your database will download in .SQL format.

click the go button

Now, as you can see below, the database is in .SQL format.

database in sql format

What if you want to export your MySQL database in an excel file or CSV file. Or any other file like in ms word. So, you can do it pretty quickly, phpMyAdmin provides a few important formats for exporting MySQL databases.

Export MySQL Database to Excel or CSV file

To export MySQL database to excel or CSV file, just go to the drop-down box as shown below. Then, select any format.

export MySQL database in any format

After selecting the format, just click on the ‘Go’ button and Done.

Now, let’s see how to import MySQL database using phpMyAdmin.

How to Import MySQL Database using phpMyAdmin

Before going to import the database, you must have a MySQL database exported already in .sql format or any other format that phpMyAdmin supports.

As you know, we have already exported the MySQL database in the first step of this tutorial. Let’s import it:

  1. To do this, go and log in to your phpMyAdmin, and first create a MySQL database as shown below.
create a mysql database using phpmyadmin

After creating a database, leave it empty no need to create any tables.

2. After that, click on the database name as shown in the image below.

just click on your MySQL database name

Note: Here is an important thing to know is that I used the same name that my previous database has. This is important only if you’re a WordPress user. Because when you create a database with a different name for WordPress then it causes errors. That error is because of a different database user.

3. Now, click on the import to select the exported database file from your PC.

click on import

4. After that select click on Choose button.

choose database file

5. Now, select the file from your PC.

select the file and import

6. Then, just click on the ‘Go’ button to import your MySQL database as shown below. You don’t have to change any other options.

click the go button to starting importing database

This will take a minute or more depending on your database size.

7. Let’s see below, your database has been imported successfully.

database imported

Congratulations! Now, you know how to import and export MySQL database using phpMyAdmin.

That’s it. I hope this tutorial will be helpful for you.

If you have any questions related to this topic then feel free to leave a comment below. And subscribe to our newsletter for more tutorials like this.

Leave a Comment