创建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';

 

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