First, export the database
1, full data derived: Table data structure +
Linux, you can use the mysqldump command to export the database, syntax is as follows: mysqldump - U user name - the p-database name > database name .sql following command to export data and table structure of the database abc: # / Home / Fairy / MySQL / bin / mysqldump - -uroot - the p-the Job > will be prompted to enter the password job.sql press the enter key, enter it. Note: mysqldump command path is based on your MySQL installation path decision.
2, only export the table structure
If you only need to export MySQL data table structure, you can use - d option, the following format: mysqldump - U user name - the p- - d database name > database name .sql following command to export the database table structure abc: # / Home / Fairy / MySQL / bin / the mysqldump - -uroot - P - D Job > job.sql
Second, import database
1, using the command to import mysql
Mysql command to import database using the following format:
mysql - U username - P database name < .sql database name
following examples abc.sql backup database into the database:
# mysql -root -Job < job.sql
2, using the command to import source
Use the source command we need to log in to mysql and create an empty database:
mysql > the Create Database abc; # create a database
mysql > use abc; database # use have created
mysql > the SET names utf8; # set the encoding
mysql > source / home / fairy / Desktop /job.sql # import the backup database
Note sql file path to your backup.