MySQL8创建库创建用户授权远程登陆

创建用户
create user ‘用户一’@’%’ identified by ‘密码’;
%代表任何地址可以登陆,换成local host只能本机登陆

刷新权限
flush privileges;

mysql8远程登陆用户认证方式错误
Authentication plugin ‘caching_sha2_password’ cannot be loaded
可以升级本机的连接,或者mysql8修改用户的远程认证方式

修改
caching_sha2_password
mysql_native_password

alter user ‘用户’@’%’ identified with mysql_native_password by ‘密码’;
flush privileges;
可以远程登陆了。

创建库
create database testDB DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
授权
grant all privileges on testDB.* to ‘用户一’@’%’ ;
同样%是任何ip能登陆
最后刷新权限就行了
flush privileges;

在本机navicat登陆成功

发布了49 篇原创文章 · 获赞 5 · 访问量 6万+

猜你喜欢

转载自blog.csdn.net/wangwenpeng0529/article/details/103595068