Skip to content

Instantly share code, notes, and snippets.

@yidas
Created July 11, 2018 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yidas/cca5e5d218f7ecac5abb2534f15ab523 to your computer and use it in GitHub Desktop.
Save yidas/cca5e5d218f7ecac5abb2534f15ab523 to your computer and use it in GitHub Desktop.
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