mysql(mariadb)之配置文件/etc/my.cnf的修改方式及查询当前值方式

本文详细介绍MariaDB服务器系统变量的设置方法,包括通过命令行、配置文件及mysql客户端进行设置。文章还介绍了如何查看所有服务器系统变量,以及变量大小单位的表示方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

mysql(mariadb)之配置文件/etc/my.cnf的修改方式及查询当前值方式

       MariaDB has many system variables that can be changed to suit your needs.
The full list of server variables are listed in the contents on this page, and most are described on this page, but some are described elsewhere:
       MariaDB has many system variables that can be changed to suit your needs.
       The full list of server variables are listed in the contents on this page, and most are described on this page, but some are described elsewhere:
       See also the Full list of MariaDB options, system and status variables.
       Most of these can be set with command line options and many of them can be changed at runtime.
       There are a few ways to see the full list of server system variables:

While in the mysql client, run:

SHOW VARIABLES;
See SHOW VARIABLES for instructions on using this command.

From your shell, run mysqld like so:

mysqld --verbose --help
View the Information Schema GLOBAL_VARIABLES, SESSION_VARIABLES, and SYSTEM_VARIABLES tables.
Setting Server System Variables
There are several ways to set server system variables:

Specify them on the command line:

shell> ./mysqld_safe --aria_group_commit=“hard”

Specify them in your my.cnf file (see Configuring MariaDB with my.cnf for more information):

aria_group_commit = “hard”

Set them from the mysql client using the SET command. Only variables that are dynamic can be set at runtime in this way. Note that variables set in this way will not persist after a restart.

SET GLOBAL aria_group_commit=“hard”;
By convention, server variables have usually been specified with an underscore in the configuration files, and a dash on the command line. You can however specify underscores as dashes - they are interchangeable(强商科技:配置变量中的下划线与破折号是一样的效果).

Variables that take a numeric size can either be specified in full, or with a suffix for easier readability. Valid suffixes are:

Suffix
Description
Value

K
kilobytes
1024

M
megabytes
10242

G
gigabytes
10243

T
terabytes
10244 (from MariaDB 10.3.3)

P
petabytes
10245 (from MariaDB 10.3.3)

E
exabytes
10246 (from MariaDB 10.3.3)

The suffix can be upper or lower-case.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值