安裝mysql成功啓動後報錯 密碼錯誤或者 密碼過期,或者其他我們統一在這裏解決
一、編輯 /etc/my.cnf
vim /etc/my.cnf
加上下面這句話
skip-grant-tables
保存並重新啓動mysql服務
service mysql restart
二、登錄mysql
啓動成功後,直接回車就進入mysql
輸入 use mysql;
DESC user;
這個就是新密碼;
三、修改密碼
update mysql.user set authentication_string=password('你的密碼') where user='root' AND host='localhost';
update user set password_expired='N' where user='root';
flush privileges;
退出 將 /etc/my.cnf 將 skip-grant-tables刪除掉,重啓動mysql 服務 就可以使用新密碼登錄了
至於說mysql 限制其他電腦連接你的mysql 服務 需要修改 root 用戶的Ip限制:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密碼' WITH GRANT OPTION;
到此 你就可以使用的mysql服務了