第一次打開mysqlshi報錯“Accerss denied for user 'root'@local

可以依次執行下面幾步:
1.Start the MySQL server instance or daemon with the –skip-grant-tables option (security setting).
$ mysqld --skip-grant-tables
2.Execute these statements.
$ mysql -u root mysql
$mysql> UPDATE user SET Password=PASSWORD('my_password') where USER='root';
$mysql> FLUSH PRIVILEGES;
3.Finally, restart the instance/daemon without the –skip-grant-tables option.
$ /etc/init.d/mysql restart
然後就可以了 stackoverflow的鏈接:http://superuser.com/questions/603026/mysql-how-to-fix-access-denied-for-user-rootlocalhost

如果上面還不行可能是沒關閉mysql服務:
1. mysqld –skip-grant-tables
2. mysql -u root
3. use mysql;
4. update user set password=PASSWORD(“NEW-ROOT-PASSWORD”) where User=’root’;
5. flush privileges;
6. quit
然後,關閉mysql 服務
5.7 mysql的密碼字段改名了 “password” => "authentication_string"

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