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.
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
Go to the Export tab
Go to the export tab as shown in the below image
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
We have selected SQL and clicked on go.
It will download the database in the testdb.sql file
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
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
Click on Go
After selecting the file scroll down you will find the go button.
Click there it will start uploading the database file
After successfully uploading tables it will show all tables in the database.
Here testdb1 contains a table uploaded from testdb database
Checking table content in testdb1.
All data was successfully imported to testdb1 from testdb database.
Import and Export mysql database command line
MySql Database Import and Export from Command Prompt
First access MySQL(MariaDB) from command prompt as below
mysql.exe -u root --password
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
mysql -u username -p database_name < file.sql
mysql -u root -p testdb1 < data.sql
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