mysql设置远程访问
修改本机配置
注释掉在/etc/mysql/mysql.conf.d/mysqld.cnf里面的bind-address = 127.0.0.1
#By default we only accept connections from localhost
#bind-address = 127.0.0.1
修改为
bind-address = 127.0.0.1
重启mysql服务 service mysql restart
添加用户
在mysql中添加远程访问用户
格式:grant 权限 on 数据库教程名.表名 to 用户@登录主机 identified by “用户密码”;
use mysql;
Grant all on *.* to 'root'@'%' identified by 'root用户的密码' with grant option;
flush privileges;
示例:
grant all privileges 'rushuo'.* to 'rushuo'@'%' identified by 'rushuo';
flush privileges;