The MySQL server, mysqld, has many command options and system variables that can be set at startup to configure its operation. MySQL服务器mysqld有许多命令选项和系统变量,可以在启动时设置这些选项和变量来配置其操作。To determine the default command option and system variable values used by the server, execute this command:要确定服务器使用的默认命令选项和系统变量值,请执行以下命令:
shell> mysqld --verbose --help
The command produces a list of all mysqld options and configurable system variables. 该命令生成所有mysqld选项和可配置系统变量的列表。Its output includes the default option and variable values and looks something like this:其输出包括默认选项和变量值,如下所示:
abort-slave-event-count 0 allow-suspicious-udfs FALSE archive ON auto-increment-increment 1 auto-increment-offset 1 autocommit TRUE automatic-sp-privileges TRUE avoid-temporal-upgrade FALSE back-log 80 basedir /home/jon/bin/mysql-8.0/ ... tmpdir /tmp transaction-alloc-block-size 8192 transaction-isolation REPEATABLE-READ transaction-prealloc-size 4096 transaction-read-only FALSE transaction-write-set-extraction XXHASH64 updatable-views-with-limit YES validate-user-plugins TRUE verbose TRUE wait-timeout 28800
To see the current system variable values actually used by the server as it runs, connect to it and execute this statement:要查看服务器运行时实际使用的当前系统变量值,请连接到服务器并执行以下语句:
mysql> SHOW VARIABLES;
To see some statistical and status indicators for a running server, execute this statement:要查看正在运行的服务器的一些统计和状态指示器,请执行以下语句:
mysql> SHOW STATUS;
System variable and status information also is available using the mysqladmin command:使用mysqladmin命令还可以获得系统变量和状态信息:
shell>mysqladmin variables
shell>mysqladmin extended-status
For a full description of all command options, system variables, and status variables, see these sections:有关所有命令选项、系统变量和状态变量的完整说明,请参见以下部分:
More detailed monitoring information is available from the Performance Schema; see Chapter 27, MySQL Performance Schema. 更详细的监控信息可从性能模式获得;参见第27章,“MySQL性能模式”。In addition, the MySQL 此外,MySQL sys
schema is a set of objects that provides convenient access to data collected by the Performance Schema; see Chapter 28, MySQL sys Schema.sys
架构是一组对象,提供了对性能模式收集的数据的方便访问;参见第28章,MySQL sys 架构。
If you specify an option on the command line for mysqld or mysqld_safe, it remains in effect only for that invocation of the server. 如果在命令行中为mysqld或mysqld_safe指定一个选项,则该选项仅对服务器的该调用有效。To use the option every time the server runs, put it in an option file. 要在每次服务器运行时使用该选项,请将其放入选项文件中。See Section 4.2.2.2, “Using Option Files”.参见第4.2.2.2节,“使用选项文件”。