MySQL配置文件以及服务的开启关闭重启

时间:2023-11-24 14:58:26

linux系统中,配置文件路径一般为/etc/my.cnf

[root@host ~]# mysql --help|grep my.cnf
                      order of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf

[root@host ~]# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
secure_auth=1 //1 允许导出导出  0 禁止导出导出
secure_file_priv=/var/lib/mysql/mysql-file    //导入导出目录
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
federated

临时开启事件

SET GLOBAL event_scheduler = ON;

永久开启

在my.cnf中的[mysqld]部分添加如下内容:

event_scheduler=ON