若有便删除(linux系统自带的)
rpm -qa | grep mariadb rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64 #组合命令 rpm -qa | grep -i mariadb | xargs rpm -e --nodeps
rpm -qa | grep mysql rpm -e --nodeps ************
官网下载链接:https://downloads.mysql.com/archives/community/
这里我们直接下载 bundle 包,所有 rpm 安装包都在里面。
解压安装包
mkdir -p /app/mysql cd /app/mysql tar -xvf mysql-5.7.39-1.el7.x86_64.rpm-bundle.tar
必须按照顺序进行安装,因为rpm包之间相互依赖!!!
rpm -ivh mysql-community-common-5.7.39-1.el7.x86_64.rpm rpm -ivh mysql-community-libs-5.7.39-1.el7.x86_64.rpm rpm -ivh mysql-community-client-5.7.39-1.el7.x86_64.rpm rpm -ivh mysql-community-server-5.7.39-1.el7.x86_64.rpm --force --nodeps
mysql --version
service mysqld start service mysqld stop service mysqld status service mysqld restart
grep 'temporary password' /var/log/mysqld.log
默认安装路径是 /usr/bin/mysql
whereis mysql
默认配置文件是 /etc/my.cnf