<> ||'''Contents'''<
><>|| = Introduction = The [[http://dev.mysql.com/doc/refman/5.0/en/installing.html | MySQL installation document]] is pretty thorough for generic linux installs. Recent Ubuntu releases have an additional step (or two) that must be followed to install the MySQL components in a ''non-standard'' location. The most germane aspect is running two or more MySQL databases on a single server, administered by different people. == Failure Symptoms == === Cannot create database files in a non-standard location === The '''mysqld''' works during the standard install (apt-get will start the server automatically) but has the following error when creating a database at a location other than the standard ''/var/lib/mysql'' directory. {{{ sudo mysql_install_db --user=mysql --datadir=/opt/mysql/data Installing MySQL system tables... 091029 10:31:02 [Warning] Can't create test file /opt/mysql/data/pookey.lower-test 091029 10:31:02 [Warning] Can't create test file /opt/mysql/data/pookey.lower-test ERROR: 1005 Can't create table 'db' (errno: 13) }}} There are probably two problems. The first, and most significant, problem is almost certainly a problem with apparmor permissions. Go to '''/etc/apparmour.d/usr.sbin.mysqld''' and add the following lines at the bottom of the '''/usr/sbin/mysqld''' clause {{{ /opt/mysql/ r, /opt/mysql/** rwk, }}} Note that the trailing slash is important. Restart apparmor after the change. The second problem is the default [[http://dev.mysql.com/doc/refman/5.0/en/option-files.html | mysql option file]] residing in '''/etc/mysql/my.cnf''', which has default-install definitions. Copy this file to a new location and edit it for the new ''datadir'' = How to file = {{{ Thank you for taking the time to report this bug and helping to make Ubuntu better. Could you please provide the following information: * content of /var/log/daemon.log related to mysql processes: /var/log/daemon.log * apparmor audit messages related to mysqld. The output of the command: grep audit /var/log/kern.log * mysqld apparmor profile and abstraction: /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/abstractions/mysqld * list of mysqld apparmor profiles: ls -l /etc/apparmor.d/usr.sbin.mysqld* * mysql configuration stripped of private information (such as password): /etc/mysql/my.cnf * extra mysql configuration from the conf.d directory: /etc/mysql/conf.d/ * directory listing of mysql datadir (by default /var/lib/mysql): sudo ls -l /var/lib/mysql ======================= Relevant error messages }}} = Debugging procedure = ## In depth debugging procedures for this particular package or subsystem. This usually is information about the log files to gather and what to look for in them. 1. Look in /var/log/daemon.log for error messages about mysqld and mysqld_safe failing to start or stop. 2. If mysqld is not able to open files (permission denied errors) or doesn't find files, it may be related to an incorrect mysqld apparmor profile. a. Check whether there are audit messages related to mysqld (acces denied) in the kernel.log file. a. Check if mysql is configured with a custom datadir (/etc/mysql/my.cnf and files in /etc/mysql/conf.d/*). a. Check if the mysqld apparmor profile has been updated to include the custom datadir in it. If not the problem is related to an incorrect mysqld apparmor profile (/etc/apparmor.d/usr.sbin.mysqld). It needs to be updated. a. Reply with the [[#update-apparmor-profile|AppArmor stock reply]]. = How to Triage = ## Information that will facilitate the triaging of bugs for this package or subsystem. Remind triagers of the bug tags in use for this particular package. == Stock Reply == ## A stock reply to be used for initial bug reports basically asking for the stuff in "How to file". The Bugs/Responses page should include this reply. <> === Update mysqld AppArmor profile === Mark the bug as '''Invalid''' using the following stock reply: {{{ Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that you're using a non-standard location for your data directory (datadir option in my.cnf). However mysqld apparmor profile (in /etc/apparmor.d/usr.sbin.mysqld) hasn't been updated to allow access to the custom directory. See https://wiki.ubuntu.com/DebuggingApparmor#Debugging%20procedure for more information on how to update mysqld apparmor profile. }}} == How to Forward == ## In the event that the package or subsystem has an upstream bug tracker this section should contain detailed steps to forward a bug to that tracker. Some packages may just link to the general "How to Forward" page for another bug tracker like Gnome's bugzilla or freedesktop.org's bug tracker. = Known bugs = ## Description of known bug reports that may receive duplicates and how to recognise them. This information should be obtained by looking for bugs tagged as 'metabug'. * The debian-sys-maint user is not available and thus the status script reports a failure from mysqld. * Mysql configuration uses non-standard location for its data files and thus mysqld apparmor profile needs to be updated. = Non-bugs = ## How to recognise common issues arising from hardware failures, common feature requests and other invalid bugs for this category. Advice how triage them and stock responses. ---- CategoryBugSquad CategoryDebugging