![NickSoft Linux Cookbook Index](templates/subSilver/images/logo_phpBB.gif) |
NickSoft Linux Cookbook Quick howto's, Real live examples.
|
|
View previous topic :: View next topic |
Author |
Message |
NickSoft Site Admin
![](http://www.mldb.org/pic/me-and-lubka.jpg)
Joined: 13 Nov 2006 Posts: 22
|
Posted: Mon Nov 13, 2006 3:03 pm Post subject: Dump database to text file and then restore it |
|
|
mysqldump command dumps databases/tables to standart output. You can use pipe redirect to save it to file:
Code: | mysqldump [options] >dump.sql |
When you dump a database there are some options of mysqladmin you need to understand:
--skip-comments - Use this option if you want make a smaller file
--compatible - if you export database from higher version to lower you will need this option. Possible values are:--compatible=mysql323
--compatible=mysql40
--compatible=mysql323
--disable-keys - this will speed up import process
--add-drop-table - if you make backups you can assume that when you restore it, tables will be created and they need to be dropped. This option does it.
--quote-names - if you use reserved words as comumn or table names this will prevent errors during import.
How to dump a table(s):
Code: | mysqldump [i]<db_name>[/i] [i]<table1>[/i] [i]<table2>[/i] ... |
How to dump a database:
Code: | mysqldump [i]<db_name>[/i] |
How to dump a more than one database:
Code: | mysqldump [u]--databases[/u] [i]<db_name1>[/i] [i]<db_name2>[/i] ... |
How to dump all databases:
Code: | mysqldump --all-databases |
|
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|