最好在 su 下运行
-
安装wget
yum -y install wget
-
设置mysql 官方仓库
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
-
开始安装MySql
yum install mysql-server
这个要执行较长时间
如果遇到报错
Failing package is: mysql-community-common-5.7.42-1.el7.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
执行rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
再安装
参考:https://blog.csdn.net/best_dayc_cm/article/details/130804959
至此安装完成
修改密码
AlTER USER 'root'@'localhost' IDENTIFIED BY '123456';