Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Norling Jr. saved my day with the AppArmor tip, but since I had some trouble configuring it, I'm writing a more detailed answer. I'm using Ubuntu 12.04.</p> <p>Start becoming root to save the need to type all that sudos:</p> <pre><code>sudo su - </code></pre> <p>Following <a href="http://dev.mysql.com/doc/refman/5.5/en/symbolic-links.html" rel="noreferrer">MySQL docs</a>, you first move your <em>already created</em> database dir to another path:</p> <pre><code>mv /var/lib/mysql/yourdatabase /new/path/ </code></pre> <p>Here was my first trap. Check if the mysql user has access to this new path:</p> <pre><code>sudo -u mysql ls /new/path/yourdatabase </code></pre> <p>If you got access denied, you should probably give execute permission to every parent dir:</p> <pre><code>chmod a+x /new /new/path/ </code></pre> <p>Test to access the file again. If it still doesn't work, try asking a question in Stack Overflow:-)</p> <p>Link the new dir location and give it the correct permissions:</p> <pre><code> ln -s /new/path/yourdatabase /var/lib/mysql/ chown mysql:mysql /var/lib/mysql/yourdatabase </code></pre> <p>Let's edit AppArmor local configuration file. You shoudn't change /etc/apparmor.d/usr.sbin.mysqld file. Edit the local conf so you won't loose it after system updates:</p> <pre><code>emacs /etc/apparmor.d/local/usr.sbin.mysqld </code></pre> <p>add Norling Jr. configurations:</p> <pre><code>/new/path/yourdatabase/ r, /new/path/yourdatabase/** rwk, </code></pre> <p>Don't miss the last comma. Save the file and reload AppArmor configuration:</p> <pre><code>apparmor_parser -r /etc/apparmor.d/usr.sbin.mysqld </code></pre> <p>This will not just reload AppArmor MySql configuration, but also test it if there isn't any syntax error (a very important thing). If you don't run the parser, the new conf won't be applied. </p> <p>Finally just open mysql client and type <code>SHOW DATABASES</code>. If your database appears, everything is probably fine. Type 'USE yourdatabase' for another check. </p> <p>A more robust test would also reload the mysql service: 'service mysql restart' and try to access your database.</p> <p>Now I'll remember next time I need to do it. Google and SO together are the best notebook in the world :-)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload