-
關(guān)閉mysql服務(wù):
a.mysqladmin shutdown
或者
b.mysql.server stop
-
輸入命令以安全模式運(yùn)行mysql:
mysqld_safe --skip-grant-tables
-
花鍵+T 新建terminal窗口,在新窗口中輸入如下代碼:
mysql -u root
成功的不使用密碼進(jìn)入mysql
-
修改密碼:
進(jìn)入mysql數(shù)據(jù)庫
use mysql
將密碼重設(shè)為:123456
update user set authentication_string=password('123456') where user='root';
-
刷新并退出:
FLUSH PRIVILEGES;
\q
-
以新密碼進(jìn)入數(shù)據(jù)庫:
mysql -uroot -p123456