Home > Database > Mysql Tutorial > 在centos 下开启MySQL远程访问

在centos 下开启MySQL远程访问

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 15:46:56
Original
1004 people have browsed it

在默认情况下mysql是不允许远程访问的. 现在需要添加一个可以具有原创访问的mysql账号(需要进入mysql命令行下): GRANT ALL PRIVILEGES ON *.* TO remote@% IDENTIFIED BY '远程登录的明文密码' WITH GRANT OPTION; 执行如下语句生效: flush privileges; 在ce

在默认情况下mysql是不允许远程访问的.

现在需要添加一个可以具有原创访问的mysql账号(需要进入mysql命令行下):

GRANT ALL PRIVILEGES ON *.* TO remote@"% " IDENTIFIED BY '远程登录的明文密码' WITH GRANT OPTION;

执行如下语句生效:

flush privileges;

在centos默认情况下iptables是 开启的,但并未开放3306端口,需要我们手动指定.

退出mysql,终端下输入:

vi /etc/sysconfig/iptables

添加如下字符串

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

重启iptables即可:

/etc/rc.d/init.d/iptables restart

现在可以开始连接远程的mysql数据库了~

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