0

For mysql Ver 14.14 Distrib 5.6.33, for Linux (x86_64) using EditLine wrapper

in my.cnf:

tmpdir          = /var/mysql_tmpfs

in /etc/apparmor.d/usr.sbin.mysqld:

  /var/mysql_tmpfs/ rw,
  /var/mysql_tmpfs/* rw,

Permissions for folder:

drwxrwxrwt  2 mysql    mysql     4096 Nov 28 19:46 mysql_tmpfs

Which, looks right to me. However, it is failing. Right now, mysql will start. However, when I load certain pages of my application, this is the error message that I see:

2016-11-28 20:23:41 39465 [ERROR] InnoDB: Unable to lock /var/mysql_tmpfs/#sql9a29_2_0.ibd, error: 13
2016-11-28 20:23:41 39465 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2016-11-28 20:23:41 7fd2105d3700  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
2016-11-28 20:23:41 39465 [ERROR] InnoDB: Cannot create file '/var/mysql_tmpfs/#sql9a29_2_0.ibd'

However, I do not believe there is another process running. When I do a ps aux | grep mysqld, I get this:

mysql    38943  0.0  0.0   4396   736 pts/4    S    20:21   0:00 /bin/sh /usr/bin/mysqld_safe
mysql    39465 10.0  4.0 73330944 5301532 pts/4 Sl  20:21   0:16 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --log-error=/var/log/mysql/error.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306

In addition, I was able to create a file in that directory as the mysql user, which is why I'm extra sure that the user should have the required permissions.

I'm guessing this is something that I'm missing, but I've now had three other people take a look and we have not gotten anywhere. Please help.

  • 1
    try change owner to root (with same permissions), I can not warrant this for 100%, but I meet with problem where mysql + apparmor not good accept more than expect credentials. default tmp have owner root – a_vlad Nov 28 '16 at 20:46
  • What OS? Does it have some protection enabled? – Rick James Nov 29 '16 at 6:24
  • Rick - The OS is Ubuntu, 12.04.5 LTS, Precise Pangolin – jmkoni Nov 29 '16 at 12:17
  • a_vlad - we seemed to have gotten it working, but I will talk to my coworkers and see if we should consider changing the owner on the directory. – jmkoni Nov 29 '16 at 12:18
0

Found a solution:

Apparently we needed to use k to give lock file permission. So now usr.sbin.mysqld looks like this:

  /var/mysql_tmpfs/ r,
  /var/mysql_tmpfs/** rwk,

We found the answer on the oracle blog: https://blogs.oracle.com/jsmyth/entry/apparmor_and_mysql

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.