安装mysql
yum install mysql-server
启动mysql
完成后,用/etc/init.d/mysqld start 启动mysql
允许远程登录
mysql -u root -p
Enter Password: <your new password>
mysql>Grant all privileges on *.* to 'user1'@'%' identified by 'user1' with grant option;
mysql>UPDATE user SET password=PASSWORD('123456') WHERE user='user1';
FLUSH PRIVILEGES;
配置防火墙
vi /etc/sysconfig/iptables
添加
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
上面这句一定要放在
-A FORWARD -j REJECT --reject-with icmp-host-prohibited 这句之前
重启防火墙
service iptables restart
这样就可以使用客户端连接mysql了,用户名user1