MySQL 服务器,mysqld,有许多命令选项和系统变量,可以在启动时设置以配置其操作。要确定服务器使用的默认命令选项和系统变量值,请执行以下命令:The MySQL server, mysqld, has many command options and system variables that can be set at startup to configure its operation. To determine the default command option and system variable values used by the server, execute this command:
$> mysqld --verbose --help
该命令会生成所有 mysqld 选项和可配置系统变量的列表。其输出包括默认选项和变量值,看起来大致如下:The command produces a list of all mysqld options and configurable system variables. Its output includes the default option and variable values and looks something like this:
activate-all-roles-on-login FALSE admin-address (No default value) admin-port 33062 admin-ssl TRUE admin-ssl-ca (No default value) admin-ssl-capath (No default value) admin-ssl-cert (No default value) admin-ssl-cipher (No default value) admin-ssl-crl (No default value) ... transaction-prealloc-size 4096 transaction-read-only FALSE updatable-views-with-limit YES upgrade AUTO validate-config FALSE validate-user-plugins TRUE verbose TRUE wait-timeout 28800 windowing-use-high-precision TRUE xa-detach-on-prepare TRUE
要查看服务器运行时实际使用的当前系统变量值,请连接到服务器并执行此语句: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;
系统变量和状态信息也可以通过mysqladmin命令获得:System variable and status information also is available using the mysqladmin command:
$>mysqladmin variables$>mysqladmin extended-status
有关所有命令选项、系统变量和状态变量的完整说明,请参阅以下部分:For a full description of all command options, system variables, and status variables, see these sections:
更多详细的监控信息可以从性能模式(Performance Schema)获得;请参见第 29 章,MySQL 性能模式。此外,MySQL 的sys模式是一组对象,可方便地访问性能模式收集的数据;请参见第 30 章,MySQL sys 模式。More detailed monitoring information is available from the
Performance Schema; see Chapter 29, MySQL Performance Schema. In
addition, the MySQL sys schema is a set of
objects that provides convenient access to data collected by the
Performance Schema; see Chapter 30, MySQL sys Schema.
如果你在命令行上为 mysqld 或 mysqld_safe 指定了一个选项,该选项仅在该次服务器调用中生效。要每次服务器运行时都使用该选项,请将其放入选项文件中。参见 第 6.2.2.2 节,“使用选项文件”。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. To use the option every time the server runs, put it in an option file. See Section 6.2.2.2, “Using Option Files”.
Windows 用户可以执行 第 2.3.2 节,“配置:使用 MySQL 配置器” 来帮助配置 MySQL 服务器安装。这包括配置 MySQL 用户、日志文件、Windows 服务名称和示例数据库等任务。Windows users may execute Section 2.3.2, “Configuration: Using MySQL Configurator” to help configure a MySQL server installation. This includes tasks such as configuring MySQL users, log files, the Windows service name, and sample databases.