#centos 系统加载源的方式
[root@localhost ~]# cat /etc/yum.repos.d/mysql.repo
[mysql-8.0-community]
name=MySQL 8.0 Community Server
baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-8.0-community-el7-$basearch/
enabled=1
gpgcheck=1
gpgkey=import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
[root@localhost ~]# yum clean all
[root@localhost ~]# yum repolist
[root@localhost ~]# yum list | grep mysql
[root@localhost ~]#sudo yum install mysql-server
如果安装失败,就执行下面的命令
[root@localhost ~]#sudo yum install mysql-server --nogpgcheck
[root@localhost ~]#systemctl start mysqld
[root@localhost ~]# ps -ef | grep mysqld
如果出现下面的结果就是启动成功