Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MySQL change data-dir for Ubuntu 16.04

MySQL change data-dir for Ubuntu 16.04

1. Change mysql.cnf

/etc/mysql/mysql.conf.d/mysql.cnf:

set datadir = /home/mysql

2. Add apparmor alias

Apparmor is the which one locks the permission.

/etc/apparmor.d/tunables/alias:

alias /var/lib/mysql/ -> /data/newlocation/,

Reload Apparmor:

$ /etc/init.d/apparmor reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment