Changes to my.cnf don't take effect (Ubuntu 16.04, mysql 5.6)

前端 未结 2 509
遇见更好的自我
遇见更好的自我 2020-12-30 18:16

Changes I make to my.cnf don\'t seem to have any effect on the mysql environment. Here\'s a summary of what\'s happened...

I installed mysql 5.7 on Ubuntu 16.04 but

相关标签:
2条回答
  • 2020-12-30 19:07

    The config files are fine. The root cause is a bug in the MySQL 5.6 packaging for Ubuntu 16.04.

    If you check your /var/log/syslog you'll probably see a line like this:

    Sep 15 18:56:09 ip-172-31-18-162 kernel: [  383.840275] audit: type=1400 audit(1505501769.234:50): apparmor="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/etc/mysql/my.cnf.fallback" pid=25701 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
    

    A security tool called AppArmor is denying access to a symlinked file (/etc/mysql/my.cnf.fallback).

    Try this workaround, which will allow symlinks to be read by mysqld.

    echo '/etc/mysql/** lr,' >> /etc/apparmor.d/local/usr.sbin.mysqld
    systemctl reload apparmor
    

    Now mysqld should see your custom config.

    This bug appears to be fixed in the MySQL 5.7 Ubuntu package.

    0 讨论(0)
  • 2020-12-30 19:08

    Obviously my.cnf.fallback is not the correct configuration file.

    If you try this commands you can get output for possible my.cnf locations:

    $ which mysqld
    /usr/sbin/mysqld
    
    $ /usr/sbin/mysqld --verbose --help | grep -A 1 "Default options"
    Default options are read from the following files in the given order:
    /etc/mysql/my.cnf ~/.my.cnf /usr/etc/my.cnf
    

    It means mysql will check those locations for my.cnf file. Simply rename /etc/mysql/my.cnf.fallback as /etc/mysql/my.cnf:

    mv /etc/mysql/my.cnf.fallback /etc/mysql/my.cnf
    
    0 讨论(0)
提交回复
热议问题