mysql8学习手册第四部分:mysql配置文件的使用和高级配置

本文深入解析MySQL的配置方式,包括使用配置文件、启动脚本及SET命令等方法调整静态与动态参数,涵盖全局与会话变量的设置,适用于RedHat、CentOS及Debian系统的默认配置文件路径介绍。

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


第四章:Configuring Mysql

  • Using config file
  • Using global and session variables
  • Using parameters with startup script
  • Configuring the parameters
  • Changing the data directory

mysql有两种参数:Static(重启生效)和Dynamic(不用重启即可生效)

mysql变量设置:

  1. Config file

  2. Startup script

  3. Using SET command

  4. Using config file
    The default config file is /etc/my.cnf (on Red Hat and CentOS systems) and /etc/mysql/my.cnf (Debian systems)

mysql配置参考样例:

[mysqld] <---section name
<parameter_name> = <value> <---parameter values
[client]
<parameter_name> = <value>
[mysqldump]
<parameter_name> = <value>
[mysqld_safe]
<parameter_name> = <value>
[server]
<parameter_name> = <value>
  • [mysql] : Section is read by the mysql command-line client
  • [client] : Section is read by all connectingclients (including mysql cli )
  • [mysqld] : Section is read by the mysql server
  • [mysqldump] : The section is read by the backuputility called mysqldump
  • [mysqld_safe] : Read by the mysqld_safe process(MySQL Server Startup Script)
  1. Using global and session variables

Global: Applies to all the new connections
Session: Applies only to the current connection

SET GLOBAL long_query_time = 1;
SET PERSIST long_query_time = 1;
SET @@persist.long_query_time = 1;
SET SESSION long_query_time = 1;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值