mysql5.7怎么重置密碼

mysql5.7重置密碼的方法:首先執(zhí)行【update user set authentication_string = password(‘123456’) where user = ‘root’;】語句;然后重啟mysql服務即可。

mysql5.7怎么重置密碼

具體方法:

(推薦教程:mysql視頻教程

關閉MySQL5.7的權限系統(tǒng)

找到MySQL5.7的配置文件my.cnf

在文件末尾編輯增加代碼skip-grant-tables

重啟mysqld服務,登陸MySQL

$systemctl?restart?mysqld

此時再登錄mysql時,不需要密碼就登錄進去了。

修改root密碼

$use?mysql; $select?host,user,authentication_string?from?user; #修改root密碼 $update?user?set?authentication_string?=?password('123456')?where?user?=?'root';

開啟權限系統(tǒng),重啟MySQL,新密碼登錄

$vim?/etc/my.cnf #開啟權限系統(tǒng) #skip-grant-tables #重啟mysql $systemctl?restart?mysqld #新root密碼登陸 $mysql?-uroot?-p

相關推薦:mysql視頻教程

? 版權聲明
THE END
喜歡就支持一下吧
點贊11 分享