首页 > 技术文章 > Mac mysql修改my.cnf不起作用排查

tusheng 2020-05-23 17:04 原文

查询安装目录

ps -ef|grep mysql

74 59066     1   0  3:51下午 ??         0:00.74 /usr/local/mysql/bin/mysqld --user=_mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/mysqld.local.err --pid-file=/usr/local/mysql/data/mysqld.local.pid

cd /usr/local/mysql/

 

默认路径

/usr/local/mysql/support-files/my.cnf

版本不同,后期版本没有该文件

cp my-default.cnf /ect/my.cnf

这是默认加载目录,权限不同,顺序不同

/etc/my.cnf  /etc/mysql/my.cnf  /usr/local/mysql/etc/my.cnf  ~/.my.cnf

 

命令没有指定文件,只能走默认的

 

修改以后执行

select @@sql_mode;

没有变化,很神奇

 通过命令确认mysql加载的是哪个配置文件

mysql --verbose --help | grep my.cnf

mysql: [Warning] World-writable config file '/etc/my.cnf' is ignored.
                      order of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf 

[Warning] World-writable config file '/etc/my.cnf' is ignored. ???

可以写的配置文件'/etc/my.cnf'被忽略。

 

还有这个操作,手动设置

image.png

chmod 644 /etc/my.cnf

 

重启,好使。

推荐阅读