简体   繁体   中英

create dump file from database in mysql

mysqldump --host=localhost --user=root --password=sysadmin --no-data test > "C:\test1\ttt.dump";

This the command that i fire to create dump from mysql database , that's working fine and create dump with no data.

but I want some table with data , this command create dump with table that all are blank.

删除no-data开关将是我的一个疯狂猜测。

You can create dump of whole db using this command

     mysqldump -uUserName -pPassword --add-drop-database --add-drop-table --hex-blob SchemaName > FileName.sql

Just enter proper UserName,Password SchemaName and filename.

There is no possibility to do it with 1 command, but theres a way to get creative.

  1. Dump the database without data
  2. Dump only the tables you want with data

Now you have 2 options:

  • Open the second dumpfile in editor and use find/replace option to replace CREATE TABLE with CREATE TABLE IF NOT EXISTS or
  • When importing the second file with data use a --force option when importing the dump file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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