简体   繁体   English

MySQL mysqldump.exe仅备份方案

[英]MySQL mysqldump.exe is only backing up schemes

I have this command which is only creating statements to re-create the database and schemes, but it's not backing up any of the data: 我有此命令,该命令仅创建语句以重新创建数据库和方案,但不备份任何数据:

"C:\Program Files (x86)\MySQL\MySQL Workbench CE 6.0.6\mysqldump.exe" --user=myuser --password=mypassword  --host=localhost --port=3306 --result-file="Z:\mysql-backup\backup.%date:~10,4%%date:~7,2%%date:~4,2%.sql" --default-character-set=utf8 --single-transaction=TRUE --databases "wpzb" "wptt"

What am I missing? 我想念什么?

With the basic command: 使用基本命令:

mysqldump -u myuser -pmypassword --databases wpzb watt > dump_file.sql

You should get all the data and schema in one file 您应该将所有数据和架构放在一个文件中

It might be best to execute the command for each database separately: 最好分别为每个数据库执行命令:

mysqldump -u myuser -pmypassword --default-character-set=utf8 --single-transaction=TRUE  wpzb > wpzb_dump_file.sql

This way you have the schema and data for one database in one file! 这样,您可以在一个文件中拥有一个数据库的模式和数据!

Since the database is local and on the default port you can just use: 由于数据库是本地数据库,并且在默认端口上,因此您可以使用:

-u myuser -pmypassword 

And leave the localhost and port attributes off. 并保留localhost和port属性。

I tested with no-data=true in the my.ini file on Windows and running mysqldump now dumps no data. 我在Windows上的my.ini文件中使用no-data = true进行了测试,现在运行mysqldump不会转储任何数据。

my.ini 的my.ini

[client]
no-data=true
backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM