usr/bin/mysqladmin: refresh failed; error: 'Unknown error'
debian wheezy 升級後, 由於授權錯誤, 導致password給改動, 在debian的mysql safe下也無法進入.
我在/etc/mysql/my.cnf 裏面已經改動了bind-address 為局域網ip
進而運行了
GRANT ALL PRIVILEGES ON *.* TO [email protected]%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION;
然後重載授權表:
FLUSH PRIVILEGES;
然後重新啟動後, 盡管能夠遠程鏈接, 可是debian 本身報了一個mysql的error.
/etc/cron.daily/logrotate:
/usr/bin/mysqladmin: refresh failed; error: ‘Unknown error‘
error: error running shared postrotate script for ‘/var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log ‘
run-parts: /etc/cron.daily/logrotate exited with return code 1
Saved 4 messages in /home/tom/mbox
這個問題的產生是由於第一次mysql服務啟動的時候mysql_safe的error.log日誌文件是被root創建的, mysqladmin 調用cron的日誌切割清除這個日誌文件沒有權限導致的.
這個bug已經在新點兒的debian sid裏面修復了, 可是stable版本號還沒有接到這個fix.
解決的方法:
又一次配置下mysql的error_log , 在my.cnf裏面. 而且讓你的mysql對這個文件有權限.
-rw-r----- 1 root adm 517639 [2014-07-01 9:26] mysql_error.log
改動root為mysql 就能夠了
chown mysql /var/log/mysql/mysql_error.log
對於centos6,7的遠程連接失敗問題, 普遍是新裝的server
沒有root密碼的: mysqladmin -uroot password "newpass"
已經有root密碼: mysqladmin -uroot password ‘oldpasswd‘ ‘newpasswd‘
也能夠直接登錄mysql, mysql -u root;use mysql;UPDATE user SET Password = PASSWORD(‘newpass‘) WHERE user = ‘root‘;FLUSH PRIVILEGES;
丟失password: mysqld_safe --skip-grant-tables& mysql -u root mysql;
UPDATE user SET password=PASSWORD("new password") WHERE user=‘root‘; FLUSH PRIVILEGES;
給用戶授權遠程訪問, 首先確認端口[client] port=3307 [mysqld] port=3307 其次看mysql是否啟動起來, netstat -anp | grep 3307看端口占用
然後grant all privileges on *.* to [email protected]%‘ identified by ‘your_password‘ with grant option; FLUSH PRIVILEGES;
防火墻開放3307端口, iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3307 -j ACCEPT
查看規則是否生效, iptables -L -n
刪除老的規則iptables -D INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
同一時候防火墻須要保存service iptables save /etc/init.d/iptables save
或者直接改動vi /etc/sysconfig/iptables 增加
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3307 -j ACCEPT
這樣就能夠遠程登錄了.
usr/bin/mysqladmin: refresh failed; error: 'Unknown error'