在新安裝好的Centos7上剛安裝好mysql,準備進去看看,可是登錄的時候,發現報錯啦:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:yes)
如何解決呢?mysql
service mysqld stop
/usr/bin/mysqld_safe --skip-grant-tables
mysql -u root
use mysql
update user set password=PASSWORD("你的密碼") where User = 'root';
4.重啓mysql,正常登陸sql
service mysqld restart
能夠啦~~~bash