(1)安装mysql
Centos7通过yum安装最新MySQL
(2)安装mysql
【1】安装mysql
步骤1:检查yum源的mysql版本
yum repolist all |grep mysql
步骤2:启用将要安装的mysql版本
vi /etc/yum.repos.d/mysql-community.repo
步骤3:查看可用的mysql安装版本
yum repolist enabled |grep mysql
步骤4:开始安装mysql
yum -y install mysql-community-server
步骤5:启动mysql服务
service mysqld start
步骤6:查看mysql服务状态
service mysqld status
步骤7:设置mysql开机启动
systemctl enable mysqld
systemctl daemon-reload
步骤8:查看mysql用户root默认密码
/var/log/mysqld.log
步骤9:登录mysql修改默认密码
mysql -uroot -p
mysql默认密码
步骤10:修改root默认密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
步骤11:设置允许root远程远程登录
GRANT ALL PRIVILEGES ON . TO root@'%' identified by '123456';
flush privileges;
步骤12:修改mysql配置
vi /etc/my.cnf
【2】安装iptables
步骤1:安装iptables
yum install iptables-services
步骤2:编辑防火墙配置文件
vi /etc/sysconfig/iptables
步骤3:重启防火墙使配置生效
systemctl restart iptables.service
步骤4: 设置防火墙开机启动
systemctl enable iptables.service