"How Does Mysql Run" Reading Notes 2

Configuration file

The startup options set in the command line are only effective for the current startup. You need to write these repeatedly into the startup command line every time you start.
We write the startup options that need to be set each time in the configuration file, and load the corresponding startup options from this file every time the server starts. We only need to configure it once.
In the configuration file, different option groups are used for different programs. If the option group name is the same as the program name, the options in the group are specifically applied to the program. For example: the
[mysqld]group is used for the mysqlserver; the
[mysql]group is used for the client program; the
following two are more special:
[server]the startup option under the group affects all server programs;
[client]the startup option under the group will be used for all client programs;

The category corresponding to the program and the group that can be read

Program name category Readable group
mysqld Start the server [mysqld]、[server]
mysqld_safe Start the server [mysqld]、[server] 、[mysqld_safe]
mysql.server Start the server [mysqld]、[server] 、[mysql.server]
mysql Start the client [mysql]、[client]
mysqladmin Start the client [mysqladmin]、[client]
mysqldump Start the client [mysqldump]、[client]

System variable

Many variables that affect the behavior of the program are used during the running of the mysql server program, called system variables.
Use the following commands to view the system variables supported by the current server and their values.

show variables [like 匹配的模式];

There are two ways to set system variables:
1. Set via startup options
(1) Via command line, such as:

mysqld --default-storage-engine=MyISAM --max-connections=10

(2)
Fill in the configuration file through the configuration file , such as:

[server]
default-storage-engine=MyISAM
max-connections=10

2. Setting during the running of the server program
First introduce the following two scopes;
GLOBAL (global scope): affect the overall operation of the server.
SESSION (session scope): The operation that affects a client connection.
Use the set statement to modify at runtime,
one is SET[GLOBAL|SESSION] system variable name=value; the other
is SET[@@(GLOBAL|SESSION).] system variable name=value;
for example: I
want to connect to The client of the server uses MyISAM as the default storage engine;

SET GLOBAL default-storage-engine=MyISAM;

or

SET @@GLOBAL.default-storage-engine=MyISAM;

Guess you like

Origin blog.csdn.net/weixin_43213064/article/details/110752906