MYSQL 安装过程

本次需要安装MYSQL 关系型数据库。 主要是要支持JSON的数据格式。

参考文档: http://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html

安装环境: Vagrant Centos 6.7

下载MYSQL 配置

# wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm
# yum localinstall ./mysql57-community-release-el6-7.noarch.rpm
# yum install mysql-community-server

修改ROOT密码 MYSQL 5.7 密码验证非常严格。

/etc/my.cnf [mysqld] 下面增加
skip-grant-tables

update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost'; //修改密码

update mysql.user set Host='%' where user='root' //不限制外部连接

flush privileges;

还原 my.cnf 文件

关闭防火墙

/etc/selinux/config

SELINUX=disabled

setenforce 0 //临时生效

MYSQL Error : 2013

SQL Error (2013): Lost connection to MySQL server at 'waiting for initial communication packet', system error: 0

vi  /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT 
service  iptables restart 

个人配置

# Firewall configuration written by system-config-firewall 
# Manual customization of this file is not recommended. 
*filter 
:INPUT ACCEPT [0:0] 
:FORWARD ACCEPT [0:0] 
:OUTPUT ACCEPT [0:0]
 -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
 -A INPUT -p icmp -j ACCEPT
 -A INPUT -i lo -j ACCEPT
 -A INPUT -i eth0 -j ACCEPT
 -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
 -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
 -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
 -A FORWARD -p icmp -j ACCEPT
 -A FORWARD -i lo -j ACCEPT
 -A FORWARD -i eth0 -j ACCEPT
 -A INPUT -j REJECT --reject-with icmp-host-prohibited
 -A FORWARD -j REJECT --reject-with icmp-host-prohibited
 COMMIT 
Posted on Categories 数据库 Tags