0

I read that using RAM for MySQL's temporary tables should improve performance. I tried to create /etc/mysql/conf.d/local.cnf with the contents:

[mysqld]
tmpdir = /run/shm

But restarting mysql fails, with the error log saying:

140711 11:14:49 [Warning] Using unique option prefix myisam-recover instead of
myisam-recover-options is deprecated and will be removed in a future release. Please
use the full name instead.
140711 11:14:49 [Note] Plugin 'FEDERATED' is disabled.
140711 11:14:49 InnoDB: The InnoDB memory heap is disabled
140711 11:14:49 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140711 11:14:49 InnoDB: Compressed tables use zlib 1.2.8
140711 11:14:49 InnoDB: Using Linux native AIO
/usr/sbin/mysqld: Can't create/write to file '/run/shm/ibfkgz7Z' (Errcode: 13)
140711 11:14:49  InnoDB: Error: unable to create temporary file; errno: 13
140711 11:14:49 [ERROR] Plugin 'InnoDB' init function returned error.
140711 11:14:49 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140711 11:14:49 [ERROR] Unknown/unsupported storage engine: InnoDB
140711 11:14:49 [ERROR] Aborting

140711 11:14:49 [Note] /usr/sbin/mysqld: Shutdown complete

Error code 13 is "Permission denied". But considering the following output, I don't see what could be the problem.

$ ls -ld /run /run/shm
drwxr-xr-x 32 root root 1040 jul 11 09:42 /run
drwxrwxrwt  3 root root  280 jul 11 09:41 /run/shm
Arild
  • 455

1 Answers1

3

There is a dependency from apparmor security settings

You have to change configs to get tmpdir into RAM

File: /etc/mysql/my.cnf

tmpdir = /run/shm/mysql

File: /etc/apparmor.d/usr.sbin.mysqld add a line alongside with other filesystem rules

/run/shm/mysql/* rw,

And shell steps to GTD

service apparmor restart
mkdir /run/shm/mysql
chown mysql:mysql /run/shm/mysql
chmod -R 777 /run/shm/mysql
service mysql restart

Mysql daemon should be up and running after all.

PS. Don't forget to add a line to /etc/rc.local for getting system working after reboot

mkdir /run/shm/mysql && chown mysql:mysql /run/shm/mysql && chmod -R 777 /run/shm/mysql
podarok
  • 149