4.5.1.1 mysql Options

mysql supports the following options, which can be specified on the command line or in the [mysql] and [client] groups of an option file. For information about option files, see Section 4.2.3.3, “Using Option Files”.

Table 4.2 mysql Options

FormatOption FileDescriptionIntroduced
--auto-rehashauto-rehashEnable automatic rehashing 
--batchbatchDon't use history file 
--character-sets-dir=pathcharacter-sets-dirSet the default character set 
--column-namescolumn-namesWrite column names in results 
--commentscommentsWhether to retain or strip comments in statements sent to the server5.0.52
--compresscompressCompress all information sent between the client and the server 
--connect_timeout=valueconnect_timeoutThe number of seconds before connection timeout 
--database=dbnamedatabaseThe database to use 
--debug[=debug_options]debugWrite a debugging log 
--debug-infodebug-infoPrint debugging information, memory and CPU statistics when the program exits 
--default-character-set=charset_namedefault-character-setUse charset_name as the default character set 
--defaults-extra-file=file_name Read option file in addition to the usual option files 
--defaults-file=file_name Read only the given option file 
--defaults-group-suffix=str Option group suffix value5.0.10
--delimiter=strdelimiterSet the statement delimiter 
--execute=statementexecuteExecute the statement and quit 
--forceforceContinue even if an SQL error occurs 
--help Display help message and exit 
--host=host_namehostConnect to the MySQL server on the given host 
--htmlhtmlProduce HTML output 
--ignore-spacesignore-spacesIgnore spaces after function names 
--line-numbersline-numbersWrite line numbers for errors 
--local-infile[={0|1}]local-infileEnable or disable for LOCAL capability for LOAD DATA INFILE 
--max_allowed_packet=valuemax_allowed_packetThe maximum packet length to send to or receive from the server 
--max_join_size=valuemax_join_sizeThe automatic limit for rows in a join when using --safe-updates 
--named-commandsnamed-commandsEnable named mysql commands 
--net_buffer_length=valuenet_buffer_lengthThe buffer size for TCP/IP and socket communication 
--no-auto-rehash Disable automatic rehashing 
--no-beepno-beepDo not beep when errors occur 
--no-defaults Do not read any option files 
--no-named-commandsno-named-commandsDisable named mysql commands 
--no-pagerno-pagerDeprecated form of --skip-pager 
--no-teeno-teeDo not copy output to a file 
--one-databaseone-databaseIgnore statements except those for the default database named on the command line 
--pager[=command]pagerUse the given command for paging query output 
--password[=password]passwordThe password to use when connecting to the server 
--pipe On Windows, connect to server using a named pipe 
--port=port_numportThe TCP/IP port number to use for the connection 
--print-defaults Print defaults 
--prompt=format_strpromptSet the prompt to the specified format 
--protocol=typeprotocolThe connection protocol to use 
--quickquickDo not cache each query result 
--rawrawWrite column values without escape conversion 
--reconnectreconnectIf the connection to the server is lost, automatically try to reconnect 
--safe-updatessafe-updatesAllow only UPDATE and DELETE statements that specify key values 
--secure-authsecure-authDo not send passwords to the server in old (pre-4.1.1) format 
--select_limit=valueselect_limitThe automatic limit for SELECT statements when using --safe-updates 
--show-warningsshow-warningsShow warnings after each statement if there are any5.0.6
--sigint-ignoresigint-ignoreIgnore SIGINT signals (typically the result of typing Control+C) 
--silentsilentSilent mode 
--skip-auto-rehashskip-auto-rehashDisable automatic rehashing 
--skip-column-namesskip-column-namesDo not write column names in results 
--skip-line-numbersskip-line-numbersSkip line numbers for errors 
--skip-named-commandsskip-named-commandsDisable named mysql commands 
--skip-pagerskip-pagerDisable paging 
--skip-reconnectskip-reconnectDisable reconnecting 
--socket=pathsocketFor connections to localhost 
--ssl[=TRUE|FALSE] Enable an SSL connection to the server. This option is set to TRUE when any other SSL option is used, and so is normally not needed. 
--ssl-ca=file_namessl-caThe path to a file that contains a list of trusted SSL CAs 
--ssl-capath=dir_namessl-capathThe path to a directory that contains trusted SSL CA certificates in PEM format 
--ssl-cert=file_namessl-certThe name of the SSL certificate file to use for establishing a secure connection 
--ssl-cipher=cipher_listssl-cipherA list of allowable ciphers to use for SSL encryption 
--ssl-key=file_namessl-keyThe name of the SSL key file to use for establishing a secure connection 
--ssl-verify-server-certssl-verify-server-certThe server's Common Name value in its certificate is verified against the host name used when connecting to the server 
--tabletableDisplay output in tabular format 
--tee=file_nameteeAppend a copy of output to the given file 
--unbufferedunbufferedFlush the buffer after each query 
--user=user_nameuserMySQL user name to use when connecting to server 
--verbose Verbose mode 
--version Display version information and exit 
--verticalverticalPrint query output rows vertically (one line per column value) 
--waitwaitIf the connection cannot be established, wait and retry instead of aborting 
--xmlxmlProduce XML output 

You can also set the following variables by using --var_name=value. The --set-variable format is deprecated.

It is also possible to set variables by using --var_name=value. The --set-variable format is deprecated.