MySQL Not Reading Symlinks for Options Files my.cnf

Apparmor does not know anything about the new location of the my.cnf

The MySQL Server follows the symlink and tries to open the destination. But apparmor denies this.

To fix the problem, you have to add the path to the my.cnf to /etc/apparmor.d/usr.sbin.mysqld


It may be caused by apparmor which is enabled for mysqld by default from ubuntu 9.0.4. Please see http://en.wikipedia.org/wiki/AppArmor .

  • You can modify site-specific additions in /etc/apparmor.d/local/. I've suffered the same problem and edited /etc/apparmor.d/local/usr.sbin.mysqld to make it work. Be aware of the last comma in the policy file.

    # Site-specific additions and overrides for usr.sbin.mysqld.
    # For more details, please see /etc/apparmor.d/local/README.
    
    # vim:syntax=apparmor
    
    /etc/mysql/conf.d/* rl,
    @{HOMEDIRS}/** rwk,
    
  • After editing /etc/apparmor.d/local/usr.sbin.mysqld, restart apparmor service by service apparmor restart. There should be no error or warning about /etc/apparmor.d/local/usr.sbin.mysqld .
  • In my case, I wanted to use datadir and site-specific my.cnf located in users's home directory.