环境: Centos7
MySQL配置文件: /etc/my.cnf
由于直接在 /etc/my.cnf
的 [mysqld]
下添加 lower_case_table_names=1
不起作用。
于是我查看了下mysql的配置文件加载顺序:
[root@mysql etc]# mysql --help | grep my.cnf
order of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf
于是我新建了目录 mkdir -p /etc/mysql
,然后添加了 my.cnf
文件:
[root@mysql mysql]# pwd
/etc/mysql
[root@mysql mysql]# cat my.cnf
[mysqld]
port=3306
lower_case_table_names=1
重启mysql后还是不起作用。
经过百般折腾,我修改了selinux: vim /etc/selinux/config
将selinux改成disabled。重启机器就好了。
[root@mysql mysql]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted