How to Export and Import MySql Database using phpMyAdmin

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.

phpMyAdmin Home page
phpMyAdmin Home Page

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

phpMyAdmin Selecting database
Select Database

Go to Export tab

Go to export tab as shown in below image

phpMyAdmin Selecting Export tab
Go to export tab

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

phpMyAdmin Export Formats

We have selected SQL and click on go.

It will download database in 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 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

phpMyAdmin creating database
phpMyAdmin creating database

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

phpMyAdmin importing database
Import data in phpMyAdmin

Click on Go

After selecting file scroll down you will find go button.

Click there it will start uploading database file

phpMyAdmin importing database
phpMyAdmin Uploading sql file

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

Here testdb1 contains table uploded from testdb database

phpMyAdmin database list
phpMyAdmin database list in left sidebar

Checking table content in testdb1.

All data sucessfully imported to testdb1 from testdb database.

phpMyAdmin database content
phpMyAdmin table data

MySql Database Import and Export from Command Prompt

First access mysql(MariaDB) from command prompt as below

then type

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

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.

How to deploy and run a war file in XAMPP tomcat

We have create a war file a.war and now want to run in tomcat server provided with XAMPP.

We created war file using netbeans IDE there are many IDE available for java/j2ee you can easily choose any one of them

You can dowload XAMPP from here

I have developed a jsp servlet application in netbeans8.2 I want to give this code to UI developer to enhance the UI.

On his/her laptop they don’t use netbeans IDE. They have to work only with jsp files.

so how to run apache tomcat server in xampp ?

Lets see step by step how to configure war file with database in XAMPP

Start Modules

click on start to start Xampp Server’s Apache, MySql and Tomcat module here tomcat is not dependent on Apache or Mysql.

If your war is using mysql then you have to start mysql server and if you are using phpMyAdmin for MySql then Apache is needed

XAMPP Control Panel
Fig: XAMPP Control Panel

Add a Tomcat user

click on config you will get a drop down menu on that menu second option is tomcat-users.xml click on that

Creating tomcat user in XAMPP
Fig: Creating tomcat user in XAMPP

above file will open on notepad there find

the symbol <!– and –> is xml comment content written inside this is example of creating user with password and roles.

We have to create a user to manage tomcat page to deploy projects for that we create a user admin with password admin and with different roles as below.

Copy and paste this user detail after the comment line in tomcat-users.xml file as below

Fig: Creating user in tomcat

Next click on Admin it will open Apache Tomcat in web browser as below

Tomcat Server Home
Fig:Tomcat Server Home

On click on manage app a popup box will open and ask for user username and password we have provided username admin and password admin provide detail in popup window.

after authentication it will show page as below

below this page there are option to upload a directory or war file in tomcat use WAR file to deploy option and select war file and click on deploy

Tomcat Web Application Manager
Fig: Tomcat Web Application Manager

After click on uplaod it will upload war file and show uploaded war in application manager as below

Fig: Upload WAR file in XAMPP Tpmcat

click on you war filename to run it.

First Page of my site running war file
Fig: First page after running WAR file

Thats it 🙂