First let us see how to export database from phpMyAdmin
Export Mysql Database
Follow these steps to export Mysql Database
First open your phpMyAdmin
Here I am using XAMPP server I have started XAMPP Apache and MySql Services.
Click on XAMPP MySql Admin it will open following page
You can open directly http://localhost/phpmyadmin if your server is running with Apache and MySql services.
Select your database
On left hand side it shows list of all databases available in Mysql.
Select database to which to want to backup.
Here we are selecting testdb to export
Go to Export tab
Go to export tab as shown in below image
Export the database by clicking on Go button
As you are now in export tab, below on this tab you will find Go button.
Above the Go button there are various format to export data.
Different export format is as below
We have selected SQL and click on go.
It will download database in testdb.sql file
Export Method can be used to download all of few tables from database.
Export method type custom can be used to select tables to download.
Importing Database in phpMyAdmin
Create a Database where you want to import database.
Here testdb1 is created to import tables
Go to Import Tab
After creating database go to import tab and select sql file.
As shown browse your computer and select file to import in database
Click on Go
After selecting file scroll down you will find go button.
Click there it will start uploading database file
After successfully uploading tables it will show all tables in database.
Here testdb1 contains table uploded from testdb database
Checking table content in testdb1.
All data sucessfully imported to testdb1 from testdb database.
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 password.
By default it does not have any password so press enter
After login it will show all your databases.
to export database we use 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 file we use followng 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.