MySQL-- .sql file import and export

 

1. Export the entire database
mysqldump -u username -p database name> exported file name
mysqldump -u dbuser -p dbname> dbname.sql

2. Export a table
mysqldump -u username -p database name watches> Export file name
Users -p dbname -u dbuser the mysqldump> dbname_users.sql

3. deriving a database structure
the mysqldump -u -p -d dbuser Table --add-drop-dbname> D: /dbname_db.sql
-d no data --add-drop -table increase before each create a statement Table drop

4. import database
common source command
into the console mysql database, such as
mysql -u the root -p
mysql> use the database
and use the source command, after the parameter is a script file (as used herein with to .sql)
MySQL> D Source: /dbname.sql

 

 

1.  import data into the database

mysql -uroot -D database name 

1.  Import data into a table in the database to obtain

mysql -uroot -D name of the database table names

 

D:\APMServ5.2.6\MySQL5.1\bin>mysqldump -u root -p  erp lightinthebox_tags > ligh
tinthebox.sql

Guess you like

Origin www.cnblogs.com/nana-qiu/p/11766404.html