先卸载自带的mariadb
rpm -qa | grep mariadb
rpm -e --nodeps mariadb-libs-5.5.64-1.el7.x86_64
安装包
mysql-community-common-5.7.24-1.el7.x86_64.rpm
mysql-community-libs-5.7.24-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.24-1.el7.x86_64.rpm
mysql-community-client-5.7.24-1.el7.x86_64.rpm
mysql-community-server-5.7.24-1.el7.x86_64.rpm
- 依次安装软件包
rpm –ivh mysql-community-common-5.7.24-1.el7.x86_64.rpm
rpm –ivh mysql-community-libs-5.7.24-1.el7.x86_64.rpm
rpm –ivh mysql-community-libs-compat-5.7.24-1.el7.x86_64.rpm
rpm –ivh mysql-community-client-5.7.24-1.el7.x86_64.rpm
rpm –ivh mysql-community-server-5.7.24-1.el7.x86_64.rpm
报错:/usr/bin/perl is needed by mysql-community-server-5.7.19-1.el7.x86_64
缺少net-tools.x86_64,libaio.x86_64,perl.x86_64三个依赖,使用yum安装即可。
-
yum -y install perl.x86_64
-
yum install -y libaio.x86_64
-
yum -y install net-tools.x86_64
- 启动数据库
service mysqld start
- 获取root用户的临时密码
grep 'temporary password' /var/log/mysqld.log | awk -F' ' '{print $NF}'
参考:https://www.cnblogs.com/lic1005/archive/2004/01/13/7989775.html