1.wget

image-20240104093800958

wget https://dev.mysql.com/get/mysql80-community-release-el7-11.noarch.rpm

2.rpm

image-20240104094050261

rpm -ivh mysql80-community-release-el7-11.noarch.rpm

3.yum.repos.d

image-20240104094231219

cd /etc/yum.repos.d/

ls and cat /etc/yum.repos.d/

发现mysql-community-debuginfo.repo

4.cache

yum clean all

yum makecache

5.yum install (默认安装mysql 8.0)

yum install -r mysql-server

image-20240104094750388

yum会自动删除mariadb的一些文件(会影响mysql正常运行)

6.启动mysql服务

systemctl start mysqld

7.查看mysql密码

grep "password" /var/log/mysqld.log

passw: #,Cgd4n?lrcr

image-20240104095034858

8.登录mysql,首次登录需要修改密码才能操作

login: mysql -uroot -p

passw: #,Cgd4n?lrcr

9.修改密码

set password for uname@localhost = password('new password');