chetan
chetan

Reputation: 3255

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.

Upvotes: 0

Views: 656

Answers (3)

Bobby
Bobby

Reputation: 11576

Removing the no-data switch would be a wild guess of mine.

Upvotes: 4

Imre L
Imre L

Reputation: 6249

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

Upvotes: 0

Rupeshit
Rupeshit

Reputation: 1466

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.

Upvotes: 2

Related Questions