Home > Database > Mysql Tutorial > Ubuntu 设置开放 MySQL 服务远程访问教程

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

WBOY
Release: 2016-06-07 16:27:47
Original
1111 people have browsed it

第一步,修改配置文件: 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;

第二行命令使设置生效。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template