参考官网:https://dev.mysql.com/doc/refman/8.0/en/linux-installation-yum-repo.html
-
安装MySQL Yum Repository
下载https://dev.mysql.com/downloads/repo/yum/
此处下载 Red Hat Enterprise Linux 7 / Oracle Linux 7 (Architecture Independent), RPM Package
上传rpm到linux上
yum localinstall Red Hat Enterprise Linux 7 / Oracle Linux 7 (Architecture Independent), RPM Package
查看安装结果
yum repolist all | grep mysql -
yum网络安装mysql8.0
yum-config-manager --disable mysql57-community
yum-config-manager --enable mysql80-communityyum install mysql-community-server
-
yum 本地安装mysql8.0
下载rpm.tar https://dev.mysql.com/downloads/mysql/
Red Hat Enterprise Linux 7 / Oracle Linux 7 (x86, 64-bit), RPM Bundle
mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar
上传rpm.tar到linux
解压:
tar -xvf mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar
安装
yum localinstall mysql-community-server.rpm
删除
rm -rf mysql* -
启动mysql服务器
service mysqld start
grep ‘temporary password’ /var/log/mysqld.log
mysql -uroot -p -
修改root密码
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘MyNewPass4!’; -
重装
yum remove mysql
rm -rf /var/lib/mysql
rm -rf /var/log/mysqld.log
找不到临时密码
rm -rf /var/lib/mysql
systemctl restart mysqld
grep ‘temporary password’ /var/log/mysqld.log