Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySQLDUmp order 1

Status
Not open for further replies.

QatQat

IS-IT--Management
Nov 16, 2001
1,031
IT
Hi there,

I think there is no way of doing this but it is worth posting it anyway.

When I do a dump to export a database, mysql put all tables in alphabetical order


articles
brokers
cities
....
login
....
users


Now, many of my tables are InnoDB;
Example: my login table is InnoDB with a foreign key to the USERs table, therefore, when I restore the database it gives me an error in creating the table because the users table does not yet exists.
Is there a way of avoiding to manually modify the dump script moving tables around o rinserting 'if exist' options?
This is becoming an issue as our system is composed by over 100 tables 60 of which is not in the correct place in the dump and has to be moved around every time.


Thank you


Qatqat The reason why my girlfriend can read my thoughts is because mine are properly written! (G.Lepore)
 
If you invoke mysqldump as such:

mysqldump [options] <databasename> <tablename> <tablename> <tablename>

the app should output the SQL statements in an order that will work for creating the tables in the right order. You'll have to do the work of figuring out the order you need. Want the best answers? Ask the best questions: TANSTAAFL!
 
Yes, I have got to figure out the order anyway even when I order it manually but your way I only have to do it once.

You get a star because you told me something that I really did not know.


Thanks a lot


Qatqat The reason why my girlfriend can read my thoughts is because mine are properly written! (G.Lepore)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top