MySQL server X AppArmor

I had configured a second server and everything worked fine until I upgraded to Ubuntu 12.04. Something changed in AppArmor that was blocking the socked creation. From the MySQL log file:

[ERROR] Can’t start server : Bind on unix socket: Permission denied
[ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld2.sock ?

 

The culprit was a change in the AppArmor configuration file. Instead of writing the full path, now you’re supposed to not write /var (????). Confusingly, the path to the original MySQL socket does have the /var!!!

To add a second server, or alter the socket and data directories, add the following lines to your /etc/apparmor.d/local/usr.sbin.mysqld :

/run/mysqld/mysqld2.pid w,
/run/mysqld/mysqld2.sock w,
/home/mysql2/ r,
/home/mysql2/** rwk,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s