export-or-import

How to export / import your database from MySQL Server

Date: Posted by: Karthick In: MySQL

To export you database from MySQL follow the below steps:

First login to you Linux server with root / Administrator Privilege,

$ su root
and Enter you root password

Syntax:

# sudo mysqldump -u [username] -p [database name] > [database name].sql

Example:

# sudo mysqldump -u dbuser -p my_database > mydatabasefile.sql
Enter Your Database Password ******

 

To import you database from MySQL follow the below steps:

First login to you Linux server with root / Administrator Privilege,

$ su root

Syntax:

# mysql -u [username] -p newdatabase < [database name].sql

Example:

# sudo mysql -u dbuser -p < mydatabasefile.sql
Enter Your Database Password ******

479 Views

Top