Mysql---MySQL Server Administration
1、The Mysql Server
mysqld is the MySQL server.
1.1、Configuring the Server
a,查看Mysql Server options and configurable system variables
mysqld --verbose --help
b,查看当前正在运行的 Mysql Server实例 system variable values
SHOW VARIABLES;
c,查看当前运行的Mysql Server实例statistical and status indicators
SHOW STATUS;
1.2、Server Configuration Defaults
The MySQL server has many operating parameters, which you can change at server startup using command-line options or configuration files (option files). It is also possible to change many parameters at runtime.(Mysql Server有很多运行参数,可以在启动时通过 命令行 | 配置文件 进行修改; 也可以在运行时进行修改)
On Windows, MySQL Installer interacts with the user and creates a file named my.ini
in the base installation directory as the default option file.(windows系统中,安装目录下有个一my.ini文件作为 选项文件)After completing the installation process, you can edit the default option file at any time to modify the parameters used by the server.(安装完成后,你可以在任何时候编辑my.ini文件进行修改参数)
For non-Windows platforms, no default option file is created during either the server installation or the data directory initialization process.(对于非Windows系统,没有默认的选项文件创建)
1.3、Server Status Variables
The MySQL server maintains many status variables that provide information about its operation.(Mysql Sever 包含了运行时的 status variables 信息)
You can view these variables and their values by using the SHOW [GLOBAL | SESSION] STATUS
statement.(使用 SHOW [GLOBAL | SESSION] STATUS
查看status variables 信息)
The number of connections that were aborted because the client died without closing the connection properly.(丢弃客户端:由于 客户端不正确关闭连接)
The number of failed attempts to connect to the MySQL server.(丢弃连接:由于 尝试连接失败)
Com_
:xxx
The Com_
statement counter variables indicate the number of times each xxx
xxx
statement has been executed.(com_** 统计了 每一个 语句执行的次数)
The number of connection attempts (successful or not) to the MySQL server.(尝试连接的数量)
Innodb_row_lock_current_waits
:
The number of joins that perform table scans because they do not use indexes.(没有使用索引的join数量)
The number of queries that have taken more than long_query_time
seconds.(慢查询数量)
The number of times that a request for a table lock could be granted immediately.(立即授权获得表锁的请求数量)
The number of times that a request for a table lock could not be granted immediately and a wait was needed.(不能立即获得表锁、需要等待的请求数量)
The number of hits for open tables cache lookups.(表缓存查询数量)
The number of threads in the thread cache.(线程缓存数量)
The number of currently open connections.(线程连接数量)
The number of threads created to handle connections.(为了处理请求,线程创建数量)
The number of threads that are not sleeping.(正在执行的线程数量)
1.4、Connection Management
Connection Interfaces
Connection Volume Management(连接容量管理)
To control the maximum number of clients the server permits to connect simultaneously, set the max_connections
system variable at server startup or at runtime.(为了控制 客户端的连接,可以在启动 | 运行时 设置 max_connections
system variable)
2、MySQL Server Logs
2.1、
3、MySQL Server Components
MySQL Server includes a component-based infrastructure for extending server capabilities.(Mysql Server 基于组件的架构 为了扩展Mysql Server能力)
3.1、Installing and Uninstalling Components
Server components must be loaded into the server before they can be used.(Mysql Sever组件 在使用之前 必须被加载到Server中)
MySQL supports manual component loading at runtime and automatic loading during server startup.(Mysql 支持 在运行时 | 启动时加载组件)
The INSTALL COMPONENT
and UNINSTALL COMPONENT
SQL statements enable component loading and unloading.(install_compoment、uninstall_compoment语句 用来 安装 | 卸载组件)
eg:
INSTALL COMPONENT 'file://component_validate_password'; UNINSTALL COMPONENT 'file://component_validate_password';
3.2、Obtaining Server Component Information
The mysql.component
sytem table contains information about currently loaded components and shows which components have been registered using INSTALL COMPONENT
.(mysql.compoment 系统表 包含了 当前加载 并被用install_compoment注册 的组件 的信息)
可以通过SELECT * FROM mysql.component;
查询Mysql Server 已加载的组件信息;
4、MySQL Server Plugins
MySQL supports an plugin API.(Mysql 支持插件API)
The plugins supported by this interface include, but are not limited to, storage engines, INFORMATION_SCHEMA
tables, full-text parser plugins, and server extensions.(插件API 可以支持 存储引擎、information_schema表、full_text解析插件、Server 拓展...)
4.1、Installing and Uninstalling Plugins
MySQL supports plugin loading at server startup and runtime. It is also possible to control the activation state of loaded plugins at startup, and to unload them at runtime.(Mysql支持 在启动 | 运行时 插件加载,也可以在启动时加载、运行时卸载)
4.2、Obtaining Server Plugin Information
有几种方式查看插件信息:
a,The INFORMATION_SCHEMA.PLUGINS
table contains a row for each loaded plugin.(information_schema.plugins表中)
b,The SHOW PLUGINS
statement displays a row for each loaded plugin.(show plugins语句)
c,The mysql.plugin
table shows which plugins have been registered with INSTALL PLUGIN
.(mysql.plugin表)