Appendix C. Options Tables

Table of Contents

C.1. mysql Options
C.2. mysql Commands
C.3. mysqladmin Options
C.4. mysqldump Options

This appendix contains listings of options for the most-used MySQL programs. These tables contain brief descriptions along with hyperlinks to the manual. Where applicable, listings of commands are also supplied.

C.1. mysql Options

Table C.1. mysql Option Reference

FormatConfig FileDescriptionIntroduced
--auto-rehashauto-rehash Enable automatic rehashing  
--batchbatch Don't use history file  
-B  
--bind-address=host_name  Determine which client network interface (IP address or hostname) to use when connecting to the MySQL Server 5.1.22-ndb-6.3.4
--character-sets-dir=namecharacter-sets-dir Set the default character set  
--column-namescolumn-names Write column names in results  
--column-type-infocolumn-type-info Display result set metadata 5.1.14
-m  
--commentscomments Whether to retain or strip comments in statements sent to the server 5.1.23
-c  
--compresscompress Compress all information sent between the client and the server  
-C  
--connect_timeout=valueconnect_timeout The number of seconds before connection timeout  
--database=dbnamedatabase The database to use  
-D dbname  
dbname  
-# [debug_options]debug Write a debugging log  
--debug[=debug_options]  
--debug-checkdebug-check Print debugging information when the program exits 5.1.21
--debug-infodebug-info Print debugging information, memory and CPU statistics when the program exits  
-T  
--default-character-set=charset_namedefault-character-set Use charset_name as the default character set  
--delimiter=strdelimiter Set the statement delimiter  
--execute=statementexecute Execute the statement and quit  
-e statement  
--forceforce Continue even if an SQL error occurs  
-f  
--help  Display help message and exit  
-?  
-I  
--host=host_namehost Connect to the MySQL server on the given host  
-h host_name  
--htmlhtml Produce HTML output  
-H  
--ignore-spacesignore-spaces Ignore spaces after function names  
-i  
--line-numbersline-numbers Write line numbers for errors  
--local-infile[={0|1}]local-infile Enable or disable for LOCAL capability for LOAD DATA INFILE  
--max_allowed_packet=valuemax_allowed_packet The maximum packet length to send to or receive from the server  
--max_join_size=valuemax_join_size The automatic limit for rows in a join when using --safe-updates  
--named-commandsnamed-commands Enable named mysql commands  
-G  
--net_buffer_length=valuenet_buffer_length The buffer size for TCP/IP and socket communication  
--no-auto-rehash  Disable automatic rehashing  
-A  
--no-beepno-beep Do not beep when errors occur  
--no-named-commandsno-named-commands Disable named mysql commands  
--no-pagerno-pager Deprecated form of --skip-pager  
--no-teeno-tee Do not copy output to a file  
--one-databaseone-database Ignore statements except those for the default database named on the command line  
-o  
--pager[=command]pager Use the given command for paging query output  
--password[=password]password The password to use when connecting to the server  
-p[password]  
--port=port_numport The TCP/IP port number to use for the connection  
-P port_num  
--prompt=format_strprompt Set the prompt to the specified format  
--protocol={TCP|SOCKET|PIPE|MEMORY}protocol The connection protocol to use  
--quickquick Do not cache each query result  
-q  
--rawraw Write column values without escape conversion  
-r  
--reconnectreconnect If the connection to the server is lost, automatically try to reconnect  
--i-am-a-dummysafe-updates Allow only UPDATE and DELETE statements that specify key values  
--safe-updates  
-U  
--secure-authsecure-auth Do not send passwords to the server in old (pre-4.1.1) format  
--select_limit=valueselect_limit The automatic limit for SELECT statements when using --safe-updates  
--show-warningsshow-warnings Show warnings after each statement if there are any  
--sigint-ignoresigint-ignore Ignore SIGINT signals (typically the result of typing Control-C)  
--silentsilent Silent mode  
-s  
--skip-auto-rehashskip-auto-rehash Disable automatic rehashing  
--skip-column-namesskip-column-names Do not write column names in results  
-N  
--skip-line-numbersskip-line-numbers Skip line numbers for errors  
--skip-named-commandsskip-named-commands Disable named mysql commands  
--skip-pagerskip-pager Disable paging  
--skip-reconnectskip-reconnect Disable reconnecting  
--socket=pathsocket For connections to localhost  
-S path  
--ssl-ca=file_namessl-ca The path to a file that contains a list of trusted SSL CAs  
--ssl-capath=directory_namessl-capath The path to a directory that contains trusted SSL CA certificates in PEM format  
--ssl-cert=file_namessl-cert The name of the SSL certificate file to use for establishing a secure connection  
--ssl-cipher=cipher_listssl-cipher A list of allowable ciphers to use for SSL encryption  
--ssl-key=file_namessl-key The name of the SSL key file to use for establishing a secure connection  
--ssl-verify-server-certssl-verify-server-cert The server's Common Name value in its certificate is verified against the hostname used when connecting to the server  
--tabletable Display output in tabular format  
-t  
--tee=file_nametee Append a copy of output to the given file  
--unbufferedunbuffered Flush the buffer after each query  
--user=user_nameuser The MySQL username to use when connecting to the server  
-u user_name  
--verbose  Verbose mode  
-v  
--version  Display version information and exit  
-V  
--verticalvertical Print query output rows vertically (one line per column value)  
-E  
--waitwait If the connection cannot be established, wait and retry instead of aborting  
-w  
--xmlxml Produce XML output  
-X  

C.2. mysql Commands

C.3. mysqladmin Options

Table C.2. mysqladmin Option Reference

FormatConfig FileDescriptionIntroduced
--bind-address=host_name  Determine which client network interface (IP address or hostname) to use when connecting to the MySQL Server 5.1.22-ndb-6.3.4
create db_name  Create a new database named db_name  
debug  Tell the server to write debug information to the error log  
drop db_name  Delete the database named db_name  
extended-status  Display the server status variables and their values  
flush-hosts  Flush all information in the host cache  
flush-logs  Flush all logs  
flush-privileges  Reload the grant tables  
--compresscompress Compress all information sent between the client and the server  
-C  
--connect_timeout=secondsconnect_timeout The number of seconds before connection timeout  
--count=N  The number of iterations to make for repeated command execution  
-c N  
-# [debug_options]debug Write a debugging log  
--debug[=debug_options]  
--debug-checkdebug-check Print debugging information when the program exits 5.1.21
--debug-infodebug-info Print debugging information, memory and CPU statistics when the program exits 5.1.21
--default-character-set=charset_namedefault-character-set Use charset_name as the default character set  
--forceforce Continue even if an SQL error occurs  
-f  
--help  Display help message and exit  
-?  
--host=host_namehost Connect to the MySQL server on the given host  
-h host_name  
--no-beepno-beep Do not beep when errors occur 5.1.17
--password[=password]password The password to use when connecting to the server  
-p[password]  
--port=port_numport The TCP/IP port number to use for the connection  
-P port_num  
--protocol={TCP|SOCKET|PIPE|MEMORY}protocol The connection protocol to use  
--rrelative Show the difference between the current and previous values when used with the --sleep option  
--relative  
--shutdown_timeout=seconds  The maximum number of seconds to wait for server shutdown  
--silentsilent Silent mode  
-s  
--sleep=delaysleep Execute commands repeatedly, sleeping for delay seconds in between  
-s delay  
--socket=pathsocket For connections to localhost  
-S path  
--ssl-ca=file_namessl-ca The path to a file that contains a list of trusted SSL CAs  
--ssl-capath=directory_namessl-capath The path to a directory that contains trusted SSL CA certificates in PEM format  
--ssl-cert=file_namessl-cert The name of the SSL certificate file to use for establishing a secure connection  
--ssl-cipher=cipher_listssl-cipher A list of allowable ciphers to use for SSL encryption  
--ssl-key=file_namessl-key The name of the SSL key file to use for establishing a secure connection  
--ssl-verify-server-certssl-verify-server-cert The server's Common Name value in its certificate is verified against the hostname used when connecting to the server  
--user=user_name,user The MySQL username to use when connecting to the server  
-u user_name  
--verbose  Verbose mode  
-v  
--version  Display version information and exit  
-V  
--verticalvertical Print query output rows vertically (one line per column value)  
-E  
--waitwait If the connection cannot be established, wait and retry instead of aborting  
-w  

C.4. mysqldump Options

Table C.3. mysqldump Option Reference

FormatConfig FileDescriptionIntroduced
--add-drop-databaseadd-drop-database Add a DROP DATABASE statement before each CREATE DATABASE statement  
--add-drop-tableadd-drop-table Add a DROP TABLE statement before each CREATE TABLE statement  
--add-locksadd-locks Surround each table dump with LOCK TABLES and UNLOCK TABLES statements  
--all-databasesall-databases Dump all tables in all databases  
-A  
--all-tablespacesall-tablespaces Adds to a table dump all SQL statements needed to create any tablespaces used by an NDB Cluster table 5.1.6
-Y  
--allow-keywordsallow-keywords Allow creation of column names that are keywords  
--bind-address=host_name  Determine which client network interface (IP address or hostname) to use when connecting to the MySQL Server 5.1.22-ndb-6.3.4
--commentscomments Add comments to the dump file  
-i  
--compactcompact Produce less verbose output  
--compatible=name[,name,...]compatible Produce output that is more compatible with other database systems or with older MySQL servers  
--complete-insertcomplete-insert Use complete INSERT statements that include column names  
-c  
--create-optionscreate-options Include all MySQL-specific table options in the CREATE TABLE statements  
--databasesdatabases Dump several databases  
-D  
--delayed-insertdelayed-insert Write INSERT DELAYED statements rather than INSERT statements  
--delete-master-logsdelete-master-logs On a master replication server, delete the binary logs after performing the dump operation  
--disable-keysdisable-keys For each table, surround the INSERT statements with disable and enable keys statements  
-K  
--dump-datedump-date Include dump date in "Dump completed on" comment if --comments is given 5.1.23
--eventsevents Dump events from the dumped databases  
-E  
--extended-insertextended-insert Use multiple-row INSERT syntax that include several VALUES lists  
-e  
--fields-enclosed-by=stringfields-enclosed-by This option is used with the -T option and has the same meaning as the corresponding clause for LOAD DATA INFILE  
--fields-escaped-byfields-escaped-by This option is used with the -T option and has the same meaning as the corresponding clause for LOAD DATA INFILE  
--fields-optionally-enclosed-by=stringfields-optionally-enclosed-by This option is used with the -T option and has the same meaning as the corresponding clause for LOAD DATA INFILE  
--fields-terminated-by=stringfields-terminated-by This option is used with the -T option and has the same meaning as the corresponding clause for LOAD DATA INFILE  
--lock-all-tablesfirst-slave Deprecated. Now renamed to --lock-all-tables  
--flush-logsflush-logs Flush the MySQL server log files before starting the dump  
-F  
--flush-privilegesflush-privileges Emit a FLUSH PRIVILEGES statement after dumping the mysql database  
--help  Display help message and exit  
-?  
--hex-blobhex-blob Dump binary columns using hexadecimal notation (for example, 'abc' becomes 0x616263)  
--ignore-table=db_name.tbl_nameignore-table Do not dump the given table  
--insert-ignoreinsert-ignore Write INSERT statements with the IGNORE option  
--lines-terminated-by=stringlines-terminated-by This option is used with the -T option and has the same meaning as the corresponding clause for LOAD DATA INFILE  
--lock-all-tableslock-all-tables Lock all tables across all databases  
-x  
--lock-tableslock-tables Lock all tables before dumping them  
--log-error=file_namelog-error Append warnings and errors to the named file 5.1.18
--master-data[=value]master-data Write the binary log filename and position to the output  
--max_allowed_packet=valuemax_allowed_packet The maximum packet length to send to or receive from the server  
--net_buffer_length=valuenet_buffer_length The buffer size for TCP/IP and socket communication  
--no-autocommitno-autocommit Enclose the INSERT statements for each dumped table within SET AUTOCOMMIT=0 and COMMIT statements  
--no-create-dbno-create-db This option suppresses the CREATE DATABASE statements  
-n  
--no-create-infono-create-info Do not write CREATE TABLE statements that re-create each dumped table  
-t  
--no-set-namesno-set-names Turn off complete-insert  
--optopt This option is shorthand; it is the same as specifying --add-drop-table --add-locks --create-options --disable-keys --extended-insert --lock-tables --quick --set-charset.  
--order-by-primaryorder-by-primary Sorts each table's rows by its primary key, or by its first unique index  
--quickquick Retrieve rows for a table from the server a row at a time  
-q  
--quote-namesquote-names Quote database, table, and column names within backtick characters  
-Q  
--replacereplace Write REPLACE statements rather than INSERT statements  
--result-file=fileresult-file Direct output to a given file  
-r file  
--routinesroutines Dump stored routines (functions and procedures) from the dumped databases  
-R  
--set-charsetset-charset Add SET NAMES default_character_set to the output  
--single-transactionsingle-transaction This option issues a BEGIN SQL statement before dumping data from the server  
--skip-add-drop-tableskip-add-drop-table Do not add  
--skip-add-locksskip-add-locks Do not add locks  
--skip-commentsskip-comments Do not add comments to the dump file  
--skip-compactskip-compact Turn off compact  
--skip-disable-keysskip-disable-keys Do not disable keys  
--skip-extended-insertskip-extended-insert Turn off extended-insert  
--skip-optskip-opt Turn off the options set by opt  
--skip-quickskip-quick Do not retrieve rows for a table from the server a row at a time  
--skip-quote-namesskip-quote-names Turn off quote names  
-skip-charsetskip-set-charset Suppress the SET NAMES statement  
--skip-triggersskip-triggers Turn off triggers  
--skip-tz-utcskip-tz-utc Turn off tz-utc  
--ssl-ca=file_namessl-ca The path to a file that contains a list of trusted SSL CAs  
--ssl-capath=directory_namessl-capath The path to a directory that contains trusted SSL CA certificates in PEM format  
--ssl-cert=file_namessl-cert The name of the SSL certificate file to use for establishing a secure connection  
--ssl-cipher=cipher_listssl-cipher A list of allowable ciphers to use for SSL encryption  
--ssl-key=file_namessl-key The name of the SSL key file to use for establishing a secure connection  
--ssl-verify-server-certssl-verify-server-cert The server's Common Name value in its certificate is verified against the hostname used when connecting to the server  
--tab=pathtab Produce tab-separated data files  
-T path  
--tablestables Override the --databases or -B option  
--triggerstriggers Dump triggers for each dumped table  
--tz-utctz-utc Add SET TIME_ZONE='+00:00' to the dump file  
--where='where_condition'where Dump only rows selected by the given WHERE condition  
-w 'where_condition'  
--xmlxml Produce XML output  
-X