安装Yum Repository
[root@localhost ~]# wget https://repo.mysql.com//mysql80-community-release-el8-1.noarch.rpm
使用rpm来安装MySQL
[root@localhost ~]# rpm -ivh mysql80-community-release-el8-1.noarch.rpm
使用yum安装mysql服务
[root@localhost ~]# yum install mysql-server
检查是否已经设置为开机启动MySQL服务
[root@localhost ~]# systemctl list-unit-files|grep mysqld
mysqld.service disabled
mysqld@.service disabled
[root@localhost ~]# systemctl enable mysqld.service #设置开机启动
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.
[root@localhost ~]# systemctl list-unit-files|grep mysqld
mysqld.service enabled
mysqld@.service disabled
[root@localhost ~]# ps -ef|grep mysql # 查看是否启动MySQL服务
root 4311 32702 0 21:07 pts/4 00:00:00 grep --color=auto mysql
[root@localhost ~]# systemctl start mysqld.service #启动服务
设置密码 :