創建mysql賬號並可以遠程連接

mysql5.6

all代表接受所有操作,比如 select,insert,delete....; *.* 代表所有庫下面的所有表;% 代表這個用戶允許從任何地方登錄;爲了安全期間,這個%可以替換爲你允許的ip地址; 

create user test identified by '123456';
grant all privileges on *.* to 'test'@'%'identified by '123456' with grant option;
flush privileges ;

 

mysql8.0以上

create user test@'%' identified  by '123456';


grant all privileges on *.* to test@'%' with grant option;


flush privileges;

出現錯誤

Unable to load authentication plugin 'caching_sha2_password'.

解決方法

ALTER USER 'test'@'%' IDENTIFIED WITH mysql_native_password BY '123456';

 

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