那样就足以将数据库databasefoo的表table1

  mysqldump -u客商名 -p 密码 -d数据库名  表名> 导出的公文名 
  C:\Users\jack> mysqldump -uroot -pmysql -d sva_rec
date_rec_drv> e:\date_rec_drv.sql 

  mysqldump -u顾客名 -p密码  数据库名 > 导出的公文名 
  C:\Users\jack> mysqldump -uroot -pmysql sva_rec  >
e:\sva_rec.sql 

  mysqldump -u顾客名 -p 密码  数据库名 表名> 导出的文本名 
  C:\Users\jack> mysqldump -uroot -pmysql sva_rec
date_rec_drv> e:\date_rec_drv.sql 

mysql的数目导入也是卓殊省事的,如: 
mysql -uroot databasefoo < foo.sql 

  2.导出五个表,富含表结构和多少 

To export

If it’s an entire DB, then:

$ mysqldump -u [uname] -p[pass] db_name > db_backup.sql

If it’s all DBs, then:

$ mysqldump -u [uname] -p[pass] --all-databases > all_db_backup.sql

If it’s specific tables within a DB, then:

$ mysqldump -u [uname] -p[pass] db_name table1 table2 > table_backup.sql

You can even go as far as auto-compressing the output using gzip (if
your DB is very big):

$ mysqldump -u [uname] -p[pass] db_name | gzip > db_backup.sql.gz

If you want to do this remotely and you have the access to the server in
question, then the following would work (presuming the MySQL server is
on port 3306):

$ mysqldump -P 3306 -h [ip_address] -u [uname] -p[pass] db_name > db_backup.sql

     1.导出全方位数据库 

  常用source 命令 
  步向mysql数据库调节台, 
  如mysql -u root -p 
  mysql>use 数据库 
  然后利用source命令,前边参数为脚本文件(如这里运用的.sql) 
  mysql>source d:wcnc_db.sql

在命令行下mysql的数码导出有个很好用命令mysqldump,它的参数有一大把,能够如此查看: 
mysqldump 

这般就可以将数据库databasefoo的表table1,table2以sql情势导入foo.sql中,在那之中-uroot参数表示访问数据库的顾客名是root,假如有密码还亟需加多-p参数 

最常用的: 
mysqldump -uroot -pmysql databasefoo table1 table2 > foo.sql 

 

  3.导出贰个数据库结构 
  C:\Users\jack> mysqldump -uroot -pmysql -d sva_rec >
e:\sva_rec.sql 

  5.导入数据库 

==============

To import

Type the following command to import sql data file:

$ mysql -u username -p -h localhost DATA-BASE-NAME < data.sql

In this example, import ‘data.sql’ file into ‘blog’ database
using Sathish as username:

$ mysql -u sat -p -h localhost blog < data.sql

If you have a dedicated database server, replace localhost hostname with
with actual server name or IP address as follows:

$ mysql -u username -p -h 202.54.1.10 databasename < data.sql

OR use hostname such as mysql.cyberciti.biz

$ mysql -u username -p -h mysql.cyberciti.biz database-name < data.sql

If you do not know the database name or database name is included in sql
dump you can try out something as follows:

$ mysql -u username -p -h 202.54.1.10 < data.sql

Refer: 

If you want a GUI tool then you could probably
use SQLyog

 

C:\Users\jack> mysqldump -uroot -pmysql sva_rec date_drv >
e:\date_drv.sql 

那般就足以将foo.sql的多寡总体导入数据库databasefoo 

     4.导出三个表,唯有表结构 

相关文章