Ubuntu16.04 mysql5.7 授权远程登陆(简易)

背景

按照网上教程走了很多遍没有成功,偶然间发现需要改配置文件。。。

两步骤、三分钟解决问题

Step1. 修改配置文件

$ cd /etc/mysql/
然后查看下这里的文件,发现 my.cnf 里写着

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

于是分别查看这两个目录下有什么,最后在mysql.conf.d中的mysqld.cnf有几行

skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address          = 127.0.0.1

注释掉

#skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address          = 127.0.0.1

重启
$ sudo service mysql restart

Step2. 授权

进入数据库,选择mysql表,输入
grant all PRIVILEGES on 可访问的数据库.可访问的表 to '远程登陆的用户名'@'绑定的IP' identified by '密码' WITH GRANT OPTION;
具体参数可参考授权参数说明
然后再次输入
flush privileges;
刷新权限即可。

问题

貌似没法给一系列地址授权,比如210.*.*.*,知道怎么解决的能留言说一下吗。。。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值