mysql5.7修改binlog日志位置

/etc/mysql/mysql.conf.d/mysqld.cnf

log-bin=/data/mysql-binlog/binlog
log-bin-index=/data/mysql-binlog/binlog.index
server-id=2
expire_logs_days = 7

error:

mysqld: File '/data/mysql-binlog/binlog.index' not found (Errcode: 13 - Permission denied)

resolve:

# chown mysql.mysql /data/mysql-binlog/ -R

# vim  /etc/apparmor.d/usr.sbin.mysqld
    # Allow data dir access  #添加新的路径到此项下
    /var/lib/mysql/ r,
    /var/lib/mysql/** rwk,
    /data/mysql-binlog/ r,     
    /data/mysql-binlog/** rwk,
# systemctl restart apparmor.service 

你可能感兴趣的:(mysql5.7修改binlog日志位置)