Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does mysqldump retain index information?

Does mysqldump dump index information too, so when a dump is loaded indexes are automatically created? From the documentation I can't see anything that concretely says it does. http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html. Thank you.

like image 609
dm03514 Avatar asked May 07 '12 12:05

dm03514


People also ask

Does Mysqldump include indexes?

No, it does not export indexes. Indexes are rebuilt upon loading the mysqldump back into mysql.

Does Mysqldump include data?

Mysqldump is a command-line utility that is used to generate the logical backup of the MySQL database. It produces the SQL Statements that can be used to recreate the database objects and data. The command can also be used to generate the output in the XML, delimited text, or CSV format.

Is Mysqldump consistent?

mysqldump is used to take logical backup of the database or multiple database. --single-transaction uses a consistent read and guarantees that data seen by mysqldump does not change.

Where do Mysqldump files go?

The mysqldump tool is located in the root/bin directory of the MySQL installation directory.


2 Answers

Yes. It does. (Do one and you'll see it there).

like image 133
John Conde Avatar answered Oct 22 '22 05:10

John Conde


It depends on what you mean by index information. If you dump the CREATE TABLE statement for each table then this will dump the information about which indexes exist on each table on which columns. It won't dump the contents of each index but this info will be re-created when you replay the INSERTS in the dump file.

If you don't dump the CREATE TABLE statements then it's possible you could lose this info if you re-import the dump file into a schema that doesn't have the indexes in place.

like image 30
liquorvicar Avatar answered Oct 22 '22 05:10

liquorvicar