1.安装MySQL5.6--(MySQL安装教程)
2. 使用iptables防火墙; 开放端口
- 关闭firewall: systemctl stop firewalld.service
- 若没安装iptables:
- 查看是否安装iptables: systemctl status iptables.service
- 安装iptables: yum install -y iptables
- 安装iptables-service: yum install iptables-services
- 添加规则:
- 编辑防火墙配置文件: vi /etc/sysconfig/iptables
添加端口如下: -A INPUT -p tcp -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
(MySQL能够进行远程访问,需要在开启 iptables防火墙的情况下。tomcat也同理)
- 保存配置: service iptables save
- 重启防火墙: systemctl restart iptables.service
- 设置开机启动: systemctl enable iptables.servcie
3. 配置MySQL--(如何安装启动点击该链接)
- 进入MySQL: mysql -u root -p
- 配置远程访问权限:(远程登录的用户名为 root ,密码为 password )
- 控制台执行语句1: GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
- 控制台执行语句2: FLUSH PRIVILEGES;
4. 最后使用MySQL工具(SQLyog)连接