4.5.1.1 mysql Client Optionsmysql客户端选项

mysql supports the following options, which can be specified on the command line or in the [mysql] and [client] groups of an option file. mysql支持以下选项,可以在命令行或选项文件的[mysql][client]组中指定。For information about option files used by MySQL programs, see Section 4.2.2.2, “Using Option Files”.有关MySQL程序使用的选项文件的信息,请参阅第4.2.2.2节,“使用选项文件”

Table 4.11 mysql Client Optionsmysql客户端选项

Option Name选项名称Description描述Introduced引入版本Deprecated弃用版本
--auto-rehashEnable automatic rehashing启用自动重新清洗
--auto-vertical-outputEnable automatic vertical result set display启用自动垂直结果集显示
--batchDo not use history file不使用历史文件
--binary-as-hexDisplay binary values in hexadecimal notation以十六进制表示法显示二进制值
--binary-modeDisable \r\n - to - \n translation and treatment of \0 as end-of-query禁用从\r\n到\n的转换,并将\0视为查询结束
--bind-addressUse specified network interface to connect to MySQL Server使用指定的网络接口连接MySQL服务器
--character-sets-dirDirectory where character sets are installed安装字符集的目录
--column-namesWrite column names in results在结果中写入列名
--column-type-infoDisplay result set metadata显示结果集元数据
--commentsWhether to retain or strip comments in statements sent to the server是否保留或删除发送到服务器的语句中的注释
--compressCompress all information sent between client and server压缩客户端和服务器之间发送的所有信息8.0.18
--compression-algorithmsPermitted compression algorithms for connections to server服务器连接的允许压缩算法8.0.18
--connect-expired-passwordIndicate to server that client can handle expired-password sandbox mode向服务器指示客户端可以处理过期密码沙盒模式
--connect-timeoutNumber of seconds before connection timeout连接超时前的秒数
--databaseThe database to use要使用的数据库
--debugWrite debugging log; supported only if MySQL was built with debugging support编写调试日志;仅在MySQL构建时支持调试
--debug-checkPrint debugging information when program exits程序退出时打印调试信息
--debug-infoPrint debugging information, memory, and CPU statistics when program exits程序退出时打印调试信息、内存和CPU统计信息
--default-authAuthentication plugin to use要使用的身份验证插件
--default-character-setSpecify default character set指定默认字符集
--defaults-extra-fileRead named option file in addition to usual option files除了常规选项文件外,还读取命名选项文件
--defaults-fileRead only named option file只读命名选项文件
--defaults-group-suffixOption group suffix value选项组后缀值
--delimiterSet the statement delimiter设置语句分隔符
--dns-srv-nameUse DNS SRV lookup for host information使用DNS SRV查找主机信息8.0.22
--enable-cleartext-pluginEnable cleartext authentication plugin启用明文身份验证插件
--executeExecute the statement and quit执行语句并退出
--forceContinue even if an SQL error occurs即使发生SQL错误,也要继续
--get-server-public-keyRequest RSA public key from server从服务器请求RSA公钥
--helpDisplay help message and exit显示帮助消息并退出
--histignorePatterns specifying which statements to ignore for logging指定忽略哪些语句进行日志记录的模式
--hostHost on which MySQL server is locatedMySQL服务器所在的主机
--htmlProduce HTML output生成HTML输出
--ignore-spacesIgnore spaces after function names忽略函数名后的空格
--init-commandSQL statement to execute after connecting连接后要执行的SQL语句
--line-numbersWrite line numbers for errors写入错误行号
--load-data-local-dirDirectory for files named in LOAD DATA LOCAL statementsLOAD DATA LOCAL语句中命名的文件目录8.0.21
--local-infileEnable or disable for LOCAL capability for LOAD DATA启用或禁用LOAD DATA的本地功能
--login-pathRead login path options from .mylogin.cnf从.mylogin.cnf读取登录路径选项
--max-allowed-packetMaximum packet length to send to or receive from server发送到服务器或从服务器接收的最大数据包长度
--max-join-sizeThe automatic limit for rows in a join when using --safe-updates使用--safe-updates时对联接中的行的自动限制
--named-commandsEnable named mysql commands启用命名mysql命令
--net-buffer-lengthBuffer size for TCP/IP and socket communicationTCP/IP和套接字通信的缓冲区大小
--network-namespaceSpecify network namespace指定网络命名空间8.0.22
--no-auto-rehashDisable automatic rehashing禁用自动重新清洗
--no-beepDo not beep when errors occur发生错误时不要发出蜂鸣声
--no-defaultsRead no option files不读取选项文件
--one-databaseIgnore statements except those for the default database named on the command line忽略除命令行上指定的默认数据库之外的语句
--pagerUse the given command for paging query output使用给定的命令进行分页查询输出
--passwordPassword to use when connecting to server连接到服务器时使用的密码
--pipeConnect to server using named pipe (Windows only)使用命名管道连接到服务器(仅限Windows)
--plugin-dirDirectory where plugins are installed安装插件的目录
--portTCP/IP port number for connection用于连接的TCP/IP端口号
--print-defaultsPrint default options打印默认选项
--promptSet the prompt to the specified format将提示设置为指定格式
--protocolTransport protocol to use要使用的传输协议
--quickDo not cache each query result不缓存每个查询结果
--rawWrite column values without escape conversion写入列值而不进行转义转换
--reconnectIf the connection to the server is lost, automatically try to reconnect如果与服务器的连接丢失,请自动尝试重新连接
--safe-updates, --i-am-a-dummyAllow only UPDATE and DELETE statements that specify key values只允许指定键值的UPDATE和DELETE语句
--select-limitThe automatic limit for SELECT statements when using --safe-updates使用--safe-updates时SELECT语句的自动限制
--server-public-key-pathPath name to file containing RSA public key包含RSA公钥的文件的路径名
--shared-memory-base-nameShared-memory name for shared-memory connections (Windows only)共享内存连接的共享内存名称(仅限Windows)
--show-warningsShow warnings after each statement if there are any在每个语句后显示警告(如果有的话)
--sigint-ignoreIgnore SIGINT signals (typically the result of typing Control+C)忽略信号情报信号(通常是键入Control+C的结果)
--silentSilent mode静音模式
--skip-auto-rehashDisable automatic rehashing禁用自动重新清洗
--skip-column-namesDo not write column names in results不要在结果中写入列名
--skip-line-numbersSkip line numbers for errors跳过错误行号
--skip-named-commandsDisable named mysql commands禁用命名mysql命令
--skip-pagerDisable paging禁用分页
--skip-reconnectDisable reconnecting禁用重新连接
--socketUnix socket file or Windows named pipe to use要使用的Unix套接字文件或Windows命名管道
--ssl-caFile that contains list of trusted SSL Certificate Authorities包含受信任SSL证书颁发机构列表的文件
--ssl-capathDirectory that contains trusted SSL Certificate Authority certificate files包含受信任的SSL证书颁发机构证书文件的目录
--ssl-certFile that contains X.509 certificate包含X.509证书的文件
--ssl-cipherPermissible ciphers for connection encryption连接加密的允许密码
--ssl-crlFile that contains certificate revocation lists包含证书吊销列表的文件
--ssl-crlpathDirectory that contains certificate revocation-list files包含证书吊销列表文件的目录
--ssl-fips-modeWhether to enable FIPS mode on client side是否在客户端启用FIPS模式
--ssl-keyFile that contains X.509 key包含X.509密钥的文件
--ssl-modeDesired security state of connection to server与服务器连接的所需安全状态
--syslogLog interactive statements to syslog将交互式语句记录到syslog
--tableDisplay output in tabular format以表格形式显示输出
--teeAppend a copy of output to named file将输出副本附加到指定文件
--tls-ciphersuitesPermissible TLSv1.3 ciphersuites for encrypted connections加密连接允许的TLSv1.3密码套件8.0.16
--tls-versionPermissible TLS protocols for encrypted connections加密连接的允许TLS协议
--unbufferedFlush the buffer after each query每次查询后刷新缓冲区
--userMySQL user name to use when connecting to server连接到服务器时使用的MySQL用户名
--verboseVerbose mode详细模式
--versionDisplay version information and exit显示版本信息并退出
--verticalPrint query output rows vertically (one line per column value)垂直打印查询输出行(每列值一行)
--waitIf the connection cannot be established, wait and retry instead of aborting如果无法建立连接,请等待并重试,而不是中止
--xmlProduce XML output生成XML输出
--zstd-compression-levelCompression level for connections to server that use zstd compression使用zstd压缩的服务器连接的压缩级别8.0.18