I am attempting to relocate the database directory for my mysql installation to a newly install ssd.
Configuration:
Ubuntu 16.04
mysql Ver 14.14 Distrib 5.7.12, for Linux (x86_64) using EditLine wrapper
I modified /etc/mysql/my.cnf
to include a new database dir:
datadir = /mnt/5abeaa6e-7536-4213-bb3e-97aa9a81be16/mysql
Now in running sudo service mysql start
it brings up a permissions error:
mysqld[9002]: mysqld: Can't change dir to '/mnt/5abeaa6e-7536-4213-bb3e-97aa9a81be16/mysql/' (Errcode: 13 - Permission denied)
I have run both recursive chmod and chown commands on the new directory to match it up and the stat readout now shows as follows:
$ stat /var/lib/mysql
File: '/var/lib/mysql'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 812h/2066d Inode: 13381090 Links: 8
Access: (0700/drwx------) Uid: ( 127/ mysql) Gid: ( 134/ mysql)
Access: 2016-06-23 09:42:37.687378790 -0700
Modify: 2016-06-23 09:46:04.679025933 -0700
Change: 2016-06-23 09:46:04.679025933 -0700
Birth: -
$ stat /mnt/5abeaa6e-7536-4213-bb3e-97aa9a81be16/mysql
File: '/mnt/5abeaa6e-7536-4213-bb3e-97aa9a81be16/mysql'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 820h/2080d Inode: 3276801 Links: 3
Access: (0700/drwx------) Uid: ( 127/ mysql) Gid: ( 134/ mysql)
Access: 2016-06-23 09:45:16.190998487 -0700
Modify: 2016-06-22 18:37:37.707197266 -0700
Change: 2016-06-23 09:45:16.190998487 -0700
Birth: -
I also modified /etc/apparmor.d/usr.sbin.mysqld
to
# Allow data dir access
# /var/lib/mysql/ r,
# /var/lib/mysql/** rwk,
/mnt/5abeaa6e-7536-4213-bb3e-97aa9a81be16/mysql/ r,
/mnt/5abeaa6e-7536-4213-bb3e-97aa9a81be16/mysql/** rwk,
Any ideas would be appreciated.