![在 ubuntu 18.04 LTS 中更改 mysql log_bin 的目录](https://linux22.com/image/911677/%E5%9C%A8%20ubuntu%2018.04%20LTS%20%E4%B8%AD%E6%9B%B4%E6%94%B9%20mysql%20log_bin%20%E7%9A%84%E7%9B%AE%E5%BD%95.png)
将mysql中log_bin的目录改为fstab挂载的磁盘。
vim /etc/mysql/mysql.conf.d/mysqld.cnf
server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
工作正常,但是
vim /etc/mysql/mysql.conf.d/mysqld.cnf
server-id = 1
log_bin = /media/disk1/mysql/mysql-bin.log
chown -R mysql:mysql /media/disk1/mysql/
chmod 770 /media/disk1/mysql/
mysql 无法重新启动。
答案1
我找到了解决办法
vim etc/apparmor.d/usr.sbin.mysqld
/media/disk1/mysql/ r,
/media/disk1/mysql/** rw,
service apparmor restart
service mysql restart