1. 安装mysql源- 下载安装包:wget [http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm](http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm)- 安装:rpm -ivh [mysql-community-release-el7-5.noarch.rpm](http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm)1. 安装MySQL:`yum -y install mysql-server`2. 检查:`rpm -qa | grep mysql````text[root@localhost ~]# rpm -qa | grep mysqlmysql-community-release-el7-5.noarchmysql-community-common-5.6.51-2.el7.x86_64mysql-community-libs-5.6.51-2.el7.x86_64mysql-community-server-5.6.51-2.el7.x86_64mysql-community-client-5.6.51-2.el7.x86_64
- 启动服务:
systemctl start mysqld
[root@localhost ~]# systemctl start mysqld[root@localhost ~]#[root@localhost ~]#[root@localhost ~]# systemctl status mysqld● mysqld.service - MySQL Community ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since 三 2021-12-15 20:48:14 CST; 18s agoProcess: 19849 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS)Process: 19786 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS)Main PID: 19848 (mysqld_safe)CGroup: /system.slice/mysqld.service├─19848 /bin/sh /usr/bin/mysqld_safe --basedir=/usr└─20015 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --pid-f...12月 15 20:48:12 localhost.localdomain mysql-systemd-start[19786]: 2021-12-15 20:48:12 19824 [Note] InnoDB: Starting shutdown...12月 15 20:48:13 localhost.localdomain mysql-systemd-start[19786]: 2021-12-15 20:48:13 19824 [Note] InnoDB: Shutdown completed; log sequence numb...62598712月 15 20:48:13 localhost.localdomain mysql-systemd-start[19786]: PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !12月 15 20:48:13 localhost.localdomain mysql-systemd-start[19786]: To do so, start the server, then issue the following commands:12月 15 20:48:13 localhost.localdomain mysql-systemd-start[19786]: /usr/bin/mysqladmin -u root password 'new-password'12月 15 20:48:13 localhost.localdomain mysql-systemd-start[19786]: /usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'12月 15 20:48:13 localhost.localdomain mysql-systemd-start[19786]: Alternatively you can run:12月 15 20:48:14 localhost.localdomain mysqld_safe[19848]: 211215 20:48:14 mysqld_safe Logging to '/var/log/mysqld.log'.12月 15 20:48:14 localhost.localdomain mysqld_safe[19848]: 211215 20:48:14 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql12月 15 20:48:14 localhost.localdomain systemd[1]: Started MySQL Community Server.Hint: Some lines were ellipsized, use -l to show in full.[root@localhost ~]#[root@localhost ~]#[root@localhost ~]# netstat -tnlpActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nametcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1014/sshdtcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1350/mastertcp6 0 0 :::8001 :::* LISTEN 8863/httpdtcp6 0 0 :::3306 :::* LISTEN 20015/mysqldtcp6 0 0 :::22 :::* LISTEN 1014/sshdtcp6 0 0 ::1:25 :::* LISTEN 1350/master
```
