背景
按照网上教程走了很多遍没有成功,偶然间发现需要改配置文件。。。
两步骤、三分钟解决问题
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.*.*.*,知道怎么解决的能留言说一下吗。。。