【MySQL】MySQL改變root用戶的密碼

 爲了安全,MySQL開啓了遠程訪問,須要常常更換MySQL鏈接密碼。mysql

不知道本身有沒有開啓遠程訪問,就先看看sql

use mysql
select host, user from user;

若是是 localhost root,則只能本地訪問。若是是 % root則能夠遠程訪問。安全

修改密碼,是否爲localhost用戶決定了這裏的修改密碼的用戶,根據本身的用戶更改ide

alter user 'root'@'localhost' identified by '密碼';
alter user 'root'@'%' identified by '密碼';

若是報錯:Your password does not satisfy the current policy requirements。。。說明密碼不夠複雜ui

相關文章
相關標籤/搜索