首页 > 数据库技术 > 详细

mysql 添加远程访问

时间:2019-08-19 15:45:54      阅读:58      评论:0      收藏:0      [点我收藏+]

第一种:mysql 5.0(两种方式)

一、

在命令窗口输入,mysql -u root -p  回车,并输入密码

执行 use mysql 

执行下面句子,查看权限,root默认权限为localhost

select user,host from user;

更改root权限为%

update user set host = ‘%‘ where user = ‘root‘;

刷新

flush privileges;

二、

在命令窗口输入,mysql -u root -p  回车,并输入密码

执行 use mysql 

设置test为账户,密码为:ceshipwd,权限为%,所有人

grant all on *.*  to ‘test‘@‘%‘ identified by ‘ceshipwd‘;

如果权限不设置为所有人,可设定固定访问IP如下:

grant all on *.*  to ‘test‘@‘111.111.111.111‘ identified by ‘ceshipwd‘;

最后,刷新

flush privileges;

 

第一种:mysql 8.0以上(两种方式)

一、

在命令窗口输入,mysql -u root -p  回车,并输入密码

执行 use mysql 

执行下面句子,查看权限,root默认权限为localhost

select user,host from user;

更改root权限为%

update user set host = ‘%‘ where user = ‘root‘;

刷新

flush privileges;

二、

在命令窗口输入,mysql -u root -p  回车,并输入密码

执行 use mysql 

设置test为账户,密码为:ceshipwd,权限为%,所有人

先建立账号:

create user ‘test‘@‘%‘ identified with mysql_native_password by ‘ceshipwd‘;

再添加账号权限

grant all on *.*  to ‘test‘@‘%‘;

如果权限不设置为所有人,可设定固定访问IP如下:

grant all on *.*  to ‘test‘@‘111.111.111.111‘;

最后,刷新

flush privileges;

mysql 添加远程访问

原文:https://www.cnblogs.com/weilaibuxiangshuo/p/11377490.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!