mysql建立使用者角色後無法登陸 解決方法

2021-09-26 22:11:08 字數 1073 閱讀 4920

首先使用 mysql -u root -p 登陸 mysql 建立新使用者,

create user`yaoyan`@`%` identified by'123456';
讓他登陸某乙個資料庫

對新使用者進行授權,

grant all on (資料庫名)*.(表名,星號代表全部)* to dba@『%』;

//例子

grant all on paike.* to 'litaige'@'%';

//重新整理許可權

flush privileges;

此時使用者還是無法登陸,因為mysql預設存在,無密碼登陸的兩個使用者,必須將他們刪除後才可以使用其他使用者進行登陸

use mysql ;

select * from user where user='';

//如果存在

delete from user where user='';

////再查詢,如果不存在,

//重新整理許可權

flush privileges

此時通過此使用者遠端登入

修改密碼認證 方式

alter user 'root'@'%' identified by 'lmk@19980312' password expire never;

#修改加密規則

alter user 'root'@'%' identified with mysql_native_password by 'lmk@19980312'

;#更新一下使用者的密碼

flush privileges;

alter user 'sy5'@'%' identified by 'lmk@123456' password expire never;

#修改加密規則

alter user 'sy5'@'%' identified with mysql_native_password by 'lmk@123456'

;#更新一下使用者的密碼

flush privileges;

linux安裝mysql後root無法登入

問題 root localhost mysql mysql u root p enter password error 1045 28000 access denied for user root localhost using password no 解決方法 方法一 etc init.d mys...

針對MySQL建立使用者後無法登入的原因

但是刪除那些為空 匿名 的使用者後仍然無法登入。可能是因為沒有重啟mysql 於是只好耐著性子看mysql參考手冊。發現其中增加使用者部分有這麼一段話 其中兩個賬戶有相同的使用者名稱monty和密碼some pass。兩個賬戶均為超級使用者賬戶,具有完全的許可權可以做任何事情。乙個賬戶 monty ...

mysql 建立了新使用者後無法登入

登入失敗資訊 error 1045 28000 access denied for user test localhost using password yes 解決方案 使用root使用者登入mysql 執行sql語句 delete from mysql.user where user flush...