今天碰到一个问题,mysql启动一直失败, 而且发现指定的配置文没有生效。后来发现下面一行报警。mysql抱怨my.cnf全世界都可以写。
root@test-virtual-machine:/opt/zbox/run/mysql# ./mysqld_safe --defaults-file=/opt/zbox/etc/mysql/my.cnf --user=mysql
Warning: World-writable config file '/opt/zbox/etc/mysql/my.cnf' is ignored
Warning: World-writable config file '/opt/zbox/etc/mysql/my.cnf' is ignored
180626 10:44:33 mysqld_safe Logging to '/opt/zbox/data/mysql/test-virtual-machine.err'.
180626 10:44:33 mysqld_safe Starting mysqld daemon with databases from /opt/zbox/data/mysql
./mysqld_safe: 157: ./mysqld_safe: mysqld_safe_helper: not found
赶快查看了一下my.cnf的权限, 哎呦,不知道哪位大哥把my.cnf的权限改成777了
root@test-virtual-machine:/opt/zbox/etc/mysql# ls -lrt
总用量 4
-rwxrwxrwx 1 test test 1190 6月 26 10:23 my.cnf
敲chmod 644 my.cnf ,修改权限后mysql正常启动。
这是msyql的一个保护机制, 如果my.cnf的权限过大, 它会认为这是一个不安全的配置数据,进而采用默认的配置数据。因为
环境的问题,可能会导致mysql启动失败。