mysqldump.1.in 7.75 KB
Newer Older
1
.TH mysqldump 1 "19 December 2000" "MySQL @MYSQL_BASE_VERSION@" "MySQL database"
unknown's avatar
unknown committed
2
.SH NAME
3
mysqldump \- text\-based client for dumping or backing up mysql databases, tables and or data.
unknown's avatar
unknown committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66

.SH  USAGE
.BR "mysqldump [\fP\fIOPTIONS\fP] database [\fP\fItables\fP]"
.TP
OR
.BR "mysqldump [\fP\fIOPTIONS\fP] \-\-databases [\fP\fIOPTIONS\fP] DB1 [\fP\fIDB2 DB3...\fP]"
.TP
OR
.BR "mysqldump [\fP\fIOPTIONS\fP] \-\-all-databases [\fP\fIOPTIONS\fP]"

.SH OPTION SYNOPSIS
.B mysqldump
.RB [  \-A | \-\-all-databases ]
.RB [  \-a | \-\-all ]
.RB [  \-# | \-\-debug=... ]
.RB [  \-\-character-sets-dir=...]
.RB [ \-? | \-\-help       ]
.RB [  \-B | \-\-databases     ]
.RB [  \-c | \-\-complete-insert ]
.RB [  \-C | \-\-compress       ]
.RB [  \-\-default-character-set=...]
.RB [ \-e | \-\-extended-insert ]
.RB [  \-\-add-drop-table      ]
.RB [  \-\-add-locks          ] 
.RB [  \-\-allow-keywords      ]
.RB [  \-\-delayed-insert      ]
.RB [  \-F | \-\-flush-logs    ]
.RB [  \-f | \-\-force     ]     
.RB [  \-h | \-\-host=...       ]
.RB [  \-l | \-\-lock-tables    ]
.RB [  \-n | \-\-no-create-db ]   
.RB [  \-t | \-\-no-create-info  ]
.RB [  \-d | \-\-no-data     ]    
.RB [  \-O | \-\-set-variable var=\fP\fIoption\fP         ]               
.RB [  \-\-opt       ]         
.RB [  \-p | \-\-password\fP\fI[=...]\fP  ]
.RB [  \-P | \-\-port=...       ]
.RB [  \-q | \-\-quick      ]    
.RB [  \-Q | \-\-quote-names ]   
.RB [  \-S | \-\-socket=...  ] 
.RB [  \-\-tables   ]       
.RB [  \-T | \-\-tab=...  ]      
.RB [  \-u | \-\-user=# ]
.RB [  \-v | \-\-verbose  ]
.RB [  \-V | \-\-version ]    
.RB [  \-w | \-\-where= ]
.RB [ \-\-delayed ]
.RB [ \-e | \-\-extended-insert ]
.RB [ \-\-fields\-terminated\-by=... ]
.RB [ \-\-fields\-enclosed\-by=... ]
.RB [ \-\-fields-optionally\-enclosed\-by=... ]
.RB [ \-\-fields\-escaped\-by=... ]
.RB [ \-\-lines\-terminated\-by=... ]
.RB [ \-v | \-\-verbose ]
.RB [ \-V | \-\-version ]
.RB [ "\-O net_buffer_length=#, where # < 16M" ]
.SH DESCRIPTION
Dumping definition and data mysql database or table
.IR mysqldump
supports by executing 
.TP 
.BR  \-A | \-\-all\-databases 
Dump all the databases. This will be same as
unknown's avatar
unknown committed
67
.BR \-\-databases 
unknown's avatar
unknown committed
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
with all databases selected.
.TP                        
.BR    \-a | \-\-all
Include all MySQL specific create options.
.TP  
.BR   \-# | \-\-debug=...
Output debug log. Often this is 'd:t:o,filename`.
.TP  
.BR    \-\-character\-sets\-dir=...
Directory where character sets are
.TP 
.BR    \-? | \-\-help
Display this help message and exit.
.TP  
.BR \-B | \-\-databases
To dump several databases. Note the difference in
usage; In this case no tables are given. All name
arguments are regarded as databasenames.
'USE db_name;' will be included in the output
.TP  
.BR    \-c | \-\-complete\-insert 
Use complete insert statements.
.TP  
.BR    \-C | \-\-compress 
Use compression in server/client protocol.
.TP  
.BR    \-\-default\-character\-set=...
Set the default character set
.TP  
.BR    \-e | \-\-extended\-insert 
Allows utilization of the new, much faster
INSERT syntax.
.TP  
.BR    \-\-add\-drop\-table
Add a 'drop table' before each create.
.TP  
.BR    \-\-add\-locks
Add locks around insert statements.
.TP  
.BR    \-\-allow\-keywords 
Allow creation of column names that are keywords.
.TP  
.BR    \-\-delayed\-insert
Insert rows with INSERT DELAYED.
.TP  
.BR    \-F | \-\-flush\-logs
Flush logs file in server before starting dump.
.TP  
.BR    \-f | \-\-force 
Continue even if we get an sql\-error.
.TP  
.BR    \-h | \-\-host=...
Connect to host.
.TP  
.BR    \-l | \-\-lock\-tables
Lock all tables for read.
.TP  
.BR    \-n | \-\-no\-create\-db 
126
\&'CREATE DATABASE /*!32312 IF NOT EXISTS*/ db_name;'
unknown's avatar
unknown committed
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
will not be put in the output. The above line will
be added otherwise, if 
.BR \-\-databases 
or
.BR \-\-all\-databases 
option was given.
.TP  
.BR    \-t | \-\-no\-create\-info  
Don't write table creation info.
.TP  
.BR    \-d | \-\-no\-data
No row information.
.TP  
.BR    \-O | "\-\-set\-variable var=option"
give a variable a value. 
.BR \-\-help 
lists variables
.TP  
.BR   \-\-opt
Same as 
.BR " \-\-add\-drop\-table \-\-add\-locks \-\-all \-\-extended\-insert \-\-quick \-\-lock\-tables "
.TP  
.BR    \-p | \-\-password[=...]  
Password to use when connecting to server.
If password is not given it's solicited on the tty.
.TP  
.BR    \-P | \-\-port=...
Port number to use for connection.
.TP  
.BR    \-q | \-\-quick 
Don't buffer query, dump directly to stdout.
.TP  
.BR    \-Q | \-\-quote\-names
Quote table and column names with `
.TP  
.BR \-S | \-\-socket=...
Socket file to use for connection.
.TP  
.BR    \-\-tables
\fP\fIOverrides \fPoption 
.BR \-\-databases (\-B).
.TP  
.BR    \-T | \-\-tab=...
Creates tab separated textfile for each table to
given path. (creates .sql and .txt files).
NOTE: This only works if mysqldump is run on
the same machine as the mysqld daemon.
.TP  
.BR    \-u | \-\-user=#  
User for login if not current user.
.TP  
.BR    \-v | \-\-verbose 
Print info about the various stages.
.TP  
.BR    \-V | \-\-version   
Output version information and exit.
.TP  
.BR    \-w | \-\-where=    
dump only selected records; QUOTES mandatory!
.TP 
.BR \-\-delayed 
Insert rows with the INSERT DELAYED command. 
.TP 
.BR \-e | \-\-extended-insert 
Use the new multiline INSERT syntax. (Gives more compact and faster inserts statements.) 
.TP 
.BR \-\-fields\-terminated\-by=... 
.TP 
.BR \-\-fields\-enclosed\-by=... 
.TP 
.TP 
.BR \-\-fields-optionally\-enclosed\-by=... 
.TP 
.BR \-\-fields\-escaped\-by=... 
.TP 
.BR \-\-lines\-terminated\-by=... 
These options are used with the 
.BR -T 
option and have the same meaning as the corresponding clauses for LOAD DATA INFILE. See Mysql manual section 7.23 LOAD DATA INFILE Syntax. 
.TP 
.BR \-v | \-\-verbose 
Verbose mode. Print out more information on what the program does. 
.TP 
.BR \-V | \-\-version 
Print version information and exit. 
.TP 
.BR "\-O net_buffer_length=#, where # < 16M "
When creating multi-row-insert statements (as with option 
.BR --extended-insert 
or 
.BR --opt
), mysqldump will create rows up to net_buffer_length length. If you increase this variable, you should also ensure that the max_allowed_packet variable in the MySQL server is bigger than the net_buffer_length. 
.SH EXAMPLES
.TP
The most normal use of mysqldump is probably for making a backup of whole databases. See Mysql Manual section 21.2 Database Backups. 
.TP
mysqldump  \-\-opt \fP\fIdatabase\fP > backup-file.sql
.TP
You can read this back into MySQL with: 
.TP
.BR mysql 
\fP\fIdatabase\fP 
.BR < 
backup-file.sql
.TP
or 
.TP
.BR mysql 
\-e 'source /patch\-to\-backup/backup\-file.sql' database
.TP
However, it's also very useful to populate another MySQL server with information from a database: 
.TP
mysqldump \-\-opt \fP\fIdatabase\fP | mysql \-\-host=\fP\fIremote\-host\fP \-C database
.TP
It is possible to dump several databases with one command: 
.TP
mysqldump \-\-databases database1 [ database2 database3... ]  > my_databases.sql
.TP
If all the databases are wanted, one can use: 
.TP
mysqldump \fP\fI\-\-all\-databases\fP > all_databases.sql

.SH "SEE ALSO"
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
isamchk(1),
isamlog(1),
mysql(1),
mysqlaccess(1),
mysqladmin(1),
mysqld(1),
mysqld_multi(1),
mysqld_safe(1),
mysql_fix_privilege_tables(1),
mysqlshow(1),
mysql_zap(1),
perror(1),
replace(1)
.P
For more information please refer to the MySQL reference
manual, which may already be installed locally and which
unknown's avatar
unknown committed
266
is also available online at http://dev.mysql.com/doc/mysql/en
267 268
.SH BUGS
Please refer to http://bugs.mysql.com/ to report bugs.
unknown's avatar
unknown committed
269
.SH AUTHOR
270 271 272
Ver 1.0, distribution @MYSQL_NO_DASH_VERSION@
Michael (Monty) Widenius (monty@mysql.com),
MySQL AB (http://www.mysql.com/).
unknown's avatar
unknown committed
273 274 275 276 277
This software comes with no warranty.
Manual page by L. (Kill-9) Pedersen 
(kill-9@kill-9.dk), Mercurmedia Data Model Architect /
system developer (http://www.mercurmedia.com)

278
.\" end of man page