LAMP实验三:远程连接MySQL

MySQL-Front是Windows下一款小巧的管理Mysql的应用程序. 主要特性包括多文档界面, 语法突出, 拖拽方式的数据库和表格, 可编辑/可增加/删除的域, 可编辑/可插入/删除的记录, 可显示的成员, 可执行的SQL 脚本,提供与外程序接口, 保存数据到CSV文件等。

 

1. 增加帐号。MySQL服务器root帐号被配置成了禁止远程登入,因此需要新增加一个MySQL帐号用于远程管理:

[root@centos-server ~]$ mysql --host localhost --user root --password mysql
mysql
> CREATE USER 'amonest'@'%' IDENTIFIED BY 'xxx'; mysql> GRANT ALL PRIVILEGES ON *.* TO 'amonest'@'%' WITH GRANT OPTION;

 关于MySQL帐号和权限的信息请参考《6.3.2. Adding User Accounts》和《13.7.1.3. GRANT Syntax》。

2. 配置防火墙。原来的防火墙策略如下:

[root@centos-server ~]$ iptables -L -n --line-numbers
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination         
1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
2    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           
3    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
4    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22 
5    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:80 state NEW 
6    REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited 

Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination         
1    REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited 

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination 

按照下面的方式开启MySQL的3306端口:

[root@centos-server ~]$ iptables -I INPUT 6 -p tcp -m tcp --dport 3306 -m state --state NEW -j ACCEPT
[root@centos
-server ~]$ service iptables save iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
[root@centos
-server ~]$ service iptables restart iptables: Flushing firewall rules: [ OK ] iptables: Setting chains to policy ACCEPT: filter [ OK ] iptables: Unloading modules: [ OK ] iptables: Applying firewall rules: [ OK ]

3. OK,现在我们打开MySQL-Front,看看是不是出现了熟悉的Windows界面?

原文地址:https://www.cnblogs.com/eastson/p/2597572.html