密碼重置:
1 首先需要修改配置文件:
vim /etc/my.cnf
skip-grant-tables
重啟mysql
/etc/init.d/mysqld restart
登錄mysql,然后重置密碼
mysql -uroot -p
##登錄后重置密碼
use mysql
update mysql.user set authentication_string=password('new_passwd') where user='root'
然后刪除/etc/my.cnf中添加的一行skip-grant-tables
重啟mysqld
/etc/init.d/mysqld restart
然后嘗試重新登錄即可