sweet idleness

mysqldump schema only

March 8, 2008

Dump only the schema (data definitions, and if you are already using mysql 5, this should include triggers and stored procedures), no data.

mysqldump database –no-data=true –routines=true > outputfile.sql

mysqldump database > outputfile.sql

outputfile.sql contains the sql commands used to restore the mysql database - tables and data.
It contains “CREATE TABLE” and “INSERT INTO” commands that can be executed against a MySQL server to re-create our database.

mysqldump database –no-data=true > outputfile.sql

outputfile.sql contains the CREATE TABLE statements only.

mysqldump database –no-data=true –routines=true > outputfile.sql

When executed on a MySQL 4.X.XX server will return:
mysqldump: unknown variable ‘routines=true’

Stored procedures and triggers have only been introduced in MySQL 5.
mysqldump will backup by default all the triggers but NOT the stored procedures/functions.
The stored procedures are backed up using the –routines=true command line parameter.

mysqldump database [other options] -u user_name -p -h host_name > outputfile.sql

The -p option on the command line prompts you for a password.

Posted by george at 1:31 pm | permalink

Previous Comments

Thanks

Posted by erick at December 15, 2009, 4:43 pm

Transformer un grand ridicule, on en ridicule devient également.

Posted by coach factory outlet at December 6, 2010, 11:56 am