老爷子88 发表于 2018-10-7 10:11:54

mysql从库 Last_SQL_Errno: 1 的错误的解决过程

  Last_SQL_Errno: 1
  Last_SQL_Error: Unable to use slave's temporary directory /tmp - Can't create/write to file '/tmp/SQL_LOAD-955cf212-bd60-11e7-8698-d0946601b0e9' (Errcode: 13 - Permission denied)
  从库缓存 /tmp 下无法写入权限
  \q 退出mysql
  ll -d/tmp/
  drwxrwxrwt. 2 root root 40 11月1 03:49 /tmp/
  普通用户上执行权限是t,而不是x
  尝试处理方法 chmod o-t/tmp
  drwxrwxrwx. 2 root root 40 11月1 03:49 /tmp/(感觉这样有一定的安全隐患)
  重启mysql服务 失败,查看提示错误日志 journalctl -xe
  SELinux is preventing /usr/bin/python2.7 from read access on the directory /tmp. For complete SELinux mess
  故关掉 selinux:setenforce = 0
  ( 可以单独设置mysql写入权限的bool值
  查看:getsebool -a | grep mysql
  设置:setsebool -Pmysql_connect_any on
  设置:setsebool -P selinuxuser_mysql_connect_enabled on)
  重启mysql服务成功
  重新登录mysql 发现已经成功同步了,但又感觉这个错误不是 t 权限导致的,为了降低/tmp的安全隐患
  故退出mysql 重新重新 chmod o+t/tmp
  再重启mysql服务 登录mysql
  同步暂时无报错,后待观察

页: [1]
查看完整版本: mysql从库 Last_SQL_Errno: 1 的错误的解决过程