XAMPP export database: Export & Import MySql Database in phpMyAdmin

XAMPP export database: Export and Import MySql Database is very easy anyone can easily import and export it.

First, let us see how to export the database from phpMyAdmin

XAMPP export database from phpMyAdmin

Follow these steps to export Mysql Database

How to import the database in PHPMyAdmin XAMPP is the same as below

how to export database in xAMPP:

First, open your phpMyAdmin

Here I am using the XAMPP server I have started XAMPP Apache and MySql Services.

Click on XAMPP MySql Admin it will open the following page

You can open directly http://localhost/phpmyadmin if your server is running with Apache and MySql services.

phpMyAdmin Home page
phpMyAdmin Home Page

Select your database

On the left-hand side, it shows the list of all databases available in Mysql.

Select the database to which to want to backup.

Here we are selecting testdb to export

phpMyAdmin Selecting database
Select Database

Go to the Export tab

Go to the export tab as shown in the below image

phpMyAdmin Selecting Export tab
Go to the export tab

Export the database by clicking on the Go button

As you are now in an export tab, below this tab you will find the Go button.

Above the Go button, there are various formats to export data.

The different export format is as below

How to export SQL in phpMyAdmin
phpMyAdmin Export Formats

We have selected SQL and clicked on go.

It will download the database in the testdb.sql file

phpMyAdmin selecting format and exporting database
Export the database by clicking on go button

Export Method can be used to download all of a few tables from the database.

Export method type custom can be used to select tables to download.

XAMPP Import database in phpMyAdmin: Importing Database in phpMyAdmin

Create a Database where you want to import the database.

Here testdb1 is created to import tables

phpMyAdmin creating database
phpMyAdmin creating database

Go to Import Tab

After creating the database go to the import tab and select SQL file.

As shown browse your computer and select a file to import in the database

phpMyAdmin importing database
Import data in phpMyAdmin

Click on Go

After selecting the file scroll down you will find the go button.

Click there it will start uploading the database file

phpMyAdmin importing database
phpMyAdmin Uploading SQL file

After successfully uploading tables it will show all tables in the database.

Here testdb1 contains a table uploaded from testdb database

phpMyAdmin database list
phpMyAdmin database list in the left sidebar

Checking table content in testdb1.

All data was successfully imported to testdb1 from testdb database.

phpMyAdmin database content
phpMyAdmin table data

Import and Export mysql database command line

MySql Database Import and Export from Command Prompt

First access MySQL(MariaDB) from command prompt as below

then type

It will ask for the password.

By default, it does not have any password so press enter

After login, it will show all your databases.

to the export database, we use the following command

mysqldump -u db_username -p database_name > path_where_to_save_sql_file

mysqldump -u root -p testdb > data.sql

To Import data from the file we use the following command

Thats it.

We can easily take back up and restore data from file to database and database to file as per our requirement.

Here we have seen phpMyAdmin and command prompt based to import and export database

Read More:

  1. PHP MySQL CRUD Tutorial with MySqli and PHPMyAdmin
  2. How to fetch image from database in PHP and display in table
  3. PDO in PHP