1. 1. 安装mysql
    2. - 下载安装包:wget [http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm](http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm)
    3. - 安装:rpm -ivh [mysql-community-release-el7-5.noarch.rpm](http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm)
    4. 1. 安装MySQL`yum -y install mysql-server`
    5. 2. 检查:`rpm -qa | grep mysql`
    6. ```text
    7. [root@localhost ~]# rpm -qa | grep mysql
    8. mysql-community-release-el7-5.noarch
    9. mysql-community-common-5.6.51-2.el7.x86_64
    10. mysql-community-libs-5.6.51-2.el7.x86_64
    11. mysql-community-server-5.6.51-2.el7.x86_64
    12. mysql-community-client-5.6.51-2.el7.x86_64
    1. 启动服务:systemctl start mysqld
    1. [root@localhost ~]# systemctl start mysqld
    2. [root@localhost ~]#
    3. [root@localhost ~]#
    4. [root@localhost ~]# systemctl status mysqld
    5. mysqld.service - MySQL Community Server
    6. Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
    7. Active: active (running) since 2021-12-15 20:48:14 CST; 18s ago
    8. Process: 19849 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS)
    9. Process: 19786 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
    10. Main PID: 19848 (mysqld_safe)
    11. CGroup: /system.slice/mysqld.service
    12. ├─19848 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
    13. └─20015 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --pid-f...
    14. 12 15 20:48:12 localhost.localdomain mysql-systemd-start[19786]: 2021-12-15 20:48:12 19824 [Note] InnoDB: Starting shutdown...
    15. 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...625987
    16. 12 15 20:48:13 localhost.localdomain mysql-systemd-start[19786]: PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
    17. 12 15 20:48:13 localhost.localdomain mysql-systemd-start[19786]: To do so, start the server, then issue the following commands:
    18. 12 15 20:48:13 localhost.localdomain mysql-systemd-start[19786]: /usr/bin/mysqladmin -u root password 'new-password'
    19. 12 15 20:48:13 localhost.localdomain mysql-systemd-start[19786]: /usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
    20. 12 15 20:48:13 localhost.localdomain mysql-systemd-start[19786]: Alternatively you can run:
    21. 12 15 20:48:14 localhost.localdomain mysqld_safe[19848]: 211215 20:48:14 mysqld_safe Logging to '/var/log/mysqld.log'.
    22. 12 15 20:48:14 localhost.localdomain mysqld_safe[19848]: 211215 20:48:14 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    23. 12 15 20:48:14 localhost.localdomain systemd[1]: Started MySQL Community Server.
    24. Hint: Some lines were ellipsized, use -l to show in full.
    25. [root@localhost ~]#
    26. [root@localhost ~]#
    27. [root@localhost ~]# netstat -tnlp
    28. Active Internet connections (only servers)
    29. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    30. tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1014/sshd
    31. tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1350/master
    32. tcp6 0 0 :::8001 :::* LISTEN 8863/httpd
    33. tcp6 0 0 :::3306 :::* LISTEN 20015/mysqld
    34. tcp6 0 0 :::22 :::* LISTEN 1014/sshd
    35. tcp6 0 0 ::1:25 :::* LISTEN 1350/master

    ```