Home > Database > Mysql Tutorial > Setting MySQL program variables using options

Setting MySQL program variables using options

WBOY
Release: 2023-09-14 08:13:08
forward
750 people have browsed it

使用选项设置 MySQL 程序变量

Many MySQL programs have internal variables that are set at run time using the SET statement. Most program variables can also be set at server startup, using the same syntax as specifying program options.

Example 1

mysql has a max_allowed_packet variable that controls the maximum size of its communication buffer.

To set the max_allowed_packet variable of mysql to 16MB, you can use the commands mentioned below -

mysql --max_allowed_packet=16777216
(or)
mysql --max_allowed_packet=16M
Copy after login

The first command specifies the value in bytes. The second command, on the other hand, specifies the value in megabytes (MB, or M).

For variables with numeric values, the value can be given with the help of the suffix K, M or G to represent a multiplier of 1024, 10242 or 10243.

Example 2

In the options file, variable settings will be provided without the leading dash -

[mysql]
max_allowed_packet=16777216
(or)
[mysql]
max_allowed_packet=16M
Copy after login

If desired, underscores can be specified as dashes in option names . The option groups mentioned below are all equivalent.

They both set the server key buffer size to 512MB.

[mysqld]
key_buffer_size=512M
(or)
[mysqld]
key-buffer-size=512M
Copy after login

The above is the detailed content of Setting MySQL program variables using options. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template