下载安装mysql
https://dev.mysql.com/downloads/mysql/
解压mysql到指定文件夹 tar xvf 文件 文件夹
卸载系统自带的 mariadb-lib
rpm -qa|grep -i mariadb
##mariadb-libs-5.5.50-1.el7_2.x86_64 rpm -e mariadb-libs-5.5.50-1.el7_2.x86_64 --nodeps
依次安装mysql组件
rpm -ivh mysql-community-common-5.7.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.25-1.el7.x86_64.rpm(可不装)
rpm -ivh mysql-community-client-5.7.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.25-1.el7.x86_64.rpm
安装server会报错,需要安装yum install net-tools
安装成功后启动mysql
mysqld --initialize --user=mysql
寻找密码 cat /var/log/mysqld.log 最后为密码
开启服务 systemctl start mysqld.service
查看运行状态 systemctl status mysqld.service
启动mysql mysql -uroot -p 输入密码
修改密码 ALTER USER 'root'@'localhost' IDENTIFIED BY '
开启启动 systemctl enable mysqld.service
开放端口 firewall-cmd --zone=public --add-port=3306/tcp --permanent
重载防火墙 firewall-cmd --reload