Using kubuntu 13.04 I was not able to get apparmor to allow the socket and pid files to be written anywhere, I've set permissions on /tmp, /var, /var/run etc.. to no effect. Nor was I able to instruct apparmor (as explained in this thread) to allow this. I tried all the tips in all the relevant posts here to no effect. Perhaps the apparmor syntax changed??? Upgraded??? Who knows... Too much reading to do in too short a time.
Soultion A:
My first solution was to disable apparmor using these commands (under root or with sudo):
Code:
## run as root or use sudo
## stop apparmor
/etc/init.d/apparmor stop
/etc/init.d/apparmor teardown
## start mysqld_multi
mysqld_multi start
##verify mysql instances up and running
ps aux | grep mysql | grep -v grep
This worked but the init.d script would not start so I had to run this manually after each reboot or login
Soultion B:
With this approach you can run mysqld using your user 'root', or the better 'mysql' user. It's not an issue anymore since we will disable apparmor to stop protecting locations on the file system for the usr.sbin.mysqld profile. There is a package called apparmor-utils you will need to install, and then use the aa-complain command to make apparmor 'complain' instead of blocking the usr.sbin.mysqld profile
Code:
## run as root or use sudo
## install apparmor-utils
apt-get install apparmor-utils
Now you can instruct apparmor to complain about the usr.sbin.mysqld profile
Code:
## run as root or use sudo
aa-complain /usr/sbin/mysqld
Once this is done apparmor will echo the status of the profiles and you will be able to see the usr.sbin.mysqld profile is in complain mode:
Code:
## run as root or use sudo
/etc/init.d/apparmor status
This will show something like:
Code:
apparmor module is loaded.
6 profiles are loaded.
5 profiles are in enforce mode.
/sbin/dhclient
/usr/lib/NetworkManager/nm-dhcp-client.action
/usr/lib/connman/scripts/dhclient-script
/usr/lib/cups/backend/cups-pdf
/usr/sbin/cupsd
1 profiles are in complain mode.
/usr/sbin/mysqld
4 processes have profiles defined.
2 processes are in enforce mode.
/sbin/dhclient (2043)
/usr/sbin/cupsd (1113)
Next, you'll want to let init.d run the mysql script in /etc/init.d on startup. This is done with:
Code:
## run as root or use sudo
update-rc.d mysql defaults
You can now reboot and have your instances up and running properly.
The /etc/init.d/mysql script calls mysqld_multi and looks like this
Code:
#!/bin/sh
#
# A simple startup script for mysqld_multi by Tim Smith and Jani Tolonen.
# This script assumes that my.cnf file exists either in /etc/my.cnf or
# /root/.my.cnf and has groups [mysqld_multi] and [mysqldN]. See the
# mysqld_multi documentation for detailed instructions.
#
# This script can be used as /etc/init.d/mysql.server
#
# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 64 36
# description: A very fast and reliable SQL database engine.
#
# Version 1.0
#
basedir=/usr/
bindir=/usr/bin
if test -x $bindir/mysqld_multi
then
mysqld_multi="$bindir/mysqld_multi";
else
echo "Can't execute $bindir/mysqld_multi from dir $basedir";
exit;
fi
case "$1" in
'start' )
"$mysqld_multi" start $2
;;
'stop' )
"$mysqld_multi" stop $2
;;
'report' )
"$mysqld_multi" report $2
;;
'restart' )
"$mysqld_multi" stop $2
"$mysqld_multi" start $2
;;
*)
echo "Usage: $0 {start|stop|report|restart}" >&2
;;
esac
Good luck!
Bookmarks