# 查看操作系统版本和linux内核版本
cat /etc/redhat-release
uname -r
# 安装包下载
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.44-1.el7.x86_64.rpm-bundle.tar
tar xvf mysql-5.7.44-1.el7.x86_64.rpm-bundle.tar
# 查看是否有mysql或者mariadb的历史版本,如果有的话,需要进行卸载:
rpm -qa | grep mysql
rpm -qa | grep mariadb
yum remove mariadb-libs-5.5.68-1.el7.x86_64
# 依赖包检查及安装
rpm -qa | grep libaio
rpm -qa | grep perl
yum install -y perl-Module-Install.noarch
# 按顺序进行安装
rpm -ivh mysql-community-common-5.7.44-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.44-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.44-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.44-1.el7.x86_64.rpm
# 查找登录密码(此步骤可以跳过)
#grep 'temporary password' /var/log/mysqld.log | awk {'print $NF'}
# 如果无权限登录,在my.cnf中加入skip-grant-tables
echo "skip-grant-tables" >> /etc/my.cnf
systemctl restart mysqld
CentOS下安装mysql
于 2023-11-26 15:48:27 首次发布