In ubuntu, how to change the mysql Data Storage path is often the case when mysql data is very large. The data is stored in/var/lib/mysql by default.
The space is not large enough, so we need to modify the mysql Data Storage path and put it in a large partition so that
It can cope with mysql DATA growth. Www.2cto.com 1. set the new storage path mkdir-p/data/mysql 2. copy the original data cp-R/var/lib/mysql/*/data/mysql 3. modify the permission chown-R mysql: mysql/data/mysql www.2cto.com 4. modify the configuration file vim/etc/mysql/my. cnfdatadir & #160; & #160; & #160; & #160; & #160; & #160; & #160; & #160; =/data/mysql 5. modify the Startup File vim/etc/apparmor. d/usr. sbin. mysqld # change/var/lib/mysql r,/var/lib/mysql/** rwk, # To/data/mysql r,/data/mysql/** rwk, 6. restart apparmor/etc/init. d/apparmor restart/etc/init. d/mysql restart complete