linux下mysql8版本修改登錄密碼

包括報錯

mysql8.0報錯ERROR 1396 (HY000): Operation ALTER USER failed for ‘root‘@‘localhost‘
-- 查詢一下安全模式開關
show variables like 'sql_safe_updates';
-- 關閉安全模式
set sql_safe_updates = 0;
-- 關閉安全模式下,纔可以執行authentication_string爲空
update user set authentication_string='' where user='root';
-- authentication_string空了的情況下,纔可以真正修改密碼
-- 刷新權限表
flush privileges;
查詢對應的host
select
user, host from user;
選擇其中一個;“%”  這個位置對應的是host的值
-- 修改密碼 alter user 'root'@'%' identified by 'S32*sdf312@'; alter user 'root'@'localhost' identified by 'S32*sdf312@';

 

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