当前位置:首页 > PHP教程 > PHP总结归纳

Ubuntu设置开放MySQL服务远程访问教程

第一步,修改配置文件: vim /etc/mysql/my.cnf 找到 bind-address = 127.0.0.1 改为: bind-address = 0.0.0.0 #允许任意ip地址访问 也可以指定ip地址。 重启mysql: sudo /etc/init.d/mysqld restart 第二步,修改数据库配置: 授权root用户进行远程连接 g

第一步,修改配置文件:

vim /etc/mysql/my.cnf

找到

bind-address = 127.0.0.1

改为:

bind-address = 0.0.0.0
#允许任意ip地址访问

也可以指定ip地址。

重启mysql:

sudo /etc/init.d/mysqld restart

第二步,修改数据库配置:

授权root用户进行远程连接

grant all privileges on *.* to root@"%" identified by "password" with grant option;
flush privileges;

第二行命令使设置生效。

.syntaxhighlighter{padding-top:20px;padding-bottom:20px;}

【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!