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 -P  mysql_connect_any on

設置:setsebool -P selinuxuser_mysql_connect_enabled on)

重啓mysql服務  成功

重新登錄mysql 發現已經成功同步了,但又感覺這個錯誤不是 t 權限導致的,爲了降低/tmp的安全隱患

故退出mysql 重新重新 chmod o+t  /tmp

再重啓mysql服務 登錄mysql 

同步暫時無報錯,後待觀察

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章