mysql远程连接

来源:互联网 发布:防化学气体口罩 知乎 编辑:程序博客网 时间:2024/06/13 23:13

ubuntu16.04为例:

1.修改服务器端绑定地址

mysqld的配置地址为/etc/mysql/mysql.conf.d/mysqld.cnf文件

修改bind_address=127.0.0.1 修改为0.0.0.0

2.赋予用户远程登录的权限

update user set host ='%' where user='root';grant all on *.* to root@'%' identified by 'root';flush privileges;

3.重启mysql服务

sudo /etc/init.d/mysql restart