/etc/init.d/mysql cannot start mysqld if chroot= is enabled in my.cnf This is because the init script reads the pidfile= and socket= out of the [mysqld] section of mysqld.conf, but those paths will be relative to chroot top if chroot is defined: <pre> [mysqld] chroot = /var/chroot/mysql/ ... socket = /var/run/mysqld/mysqld.sock pid-file = /var/run/mysqld/mysqld.pid log-error = /var/log/mysql/mysqld.err </pre> In this case the actual files are /var/chroot/mysql/var/run/mysqld/mysqld.pid and /var/chroot/mysql/var/run/mysqld/mysqld.sock, but init.d/mysql doesn't figure that out. During "start", the ewaitfile on "${socket}" fails, and during "stop", the real pidfile isn't consulted so mysqld is left still running. The fix is simple, check if chroot= is defined in the [mysqld] section, and if so prepend that to the expected pidfile and socket paths. Will attach a diff. Reproducible: Always
Created attachment 380136 [details, diff] patch /etc/init.d/mysql to correctly handle DBs with chroot= set in /etc/mysql/my.cnf
Shouldn't the datadir variable also be included? This way the script will correctly check for the ${chroot}/${datadir}/mysql directory. I may be wrong in interpreting this.
Committed with mysql-init-scripts-2.0