MySQL中的系统参数

来源:互联网 发布:mac vim 编辑 编辑:程序博客网 时间:2024/06/05 17:09

MySQL提供了相当多的系统参数,涉及方方面面。我们可以使用show关键字来查看:

show variables like ‘%keyword%’;

完整的语法是
SHOW [GLOBAL | SESSION] VARIABLES
[LIKE ‘pattern’ | WHERE expr]
由语法可知,系统变量分为global和session两种:
The server maintains two kinds of system variables. Global variables affect the overall operation of the server. Session variables affect its operation for individual client connections. A given system variable can have both a global and a session value. Global and session system variables are related as follows:
When the server starts, it initializes all global variables to their default values. These defaults can be changed by options specified on the command line or in an option file.
The server also maintains a set of session variables for each client that connects. The client’s session variables are initialized at connect time using the current values of the corresponding global variables.
下面是系统参数清单:
http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html

指定或修改系统变量
System variable values can be set globally at server startup by using options on the command line or in an option file.也就是说在使用mysqld启动MySQL时,带上参数。或在my.cnf文件中加入。且一部分系统变量可以被动态修改,不需要重启MySQL。例如:

mysql> SET GLOBAL general-log=ON;

下面是所有动态参数的清单:
https://dev.mysql.com/doc/refman/5.7/en/dynamic-system-variables.html

0 0
原创粉丝点击