1. Download the MySQL version corresponding to the system and upload it to the server to be installed.
MySQL :: Download MySQL Yum Repository
2. Start the installation
- Add to yum library
- Order:
#下载 https://repo.mysql.com//mysql80-community-release-el8-1.noarch.rpm yum install mysql80-community-release-el7-3.noarch.rpm
- Check whether the command was added successfully:
yum repolist enabled | grep "mysql.*-community.*"
- Order:
- Installation command:
yum install mysql-community-server # 如果出现 Unable to find a match: mysql-community-server 请先禁用本地组件再安装 yum module disable mysql yum install mysql-community-server
- Check the installation directory and version
- StartMySQL
systemctl start mysqld
After successful startup, you need to generate a temporary password to log in and modify and set a new password.
# 生成 root@localhost 的临时密码
grep 'temporary password' /var/log/mysqld.log
Use temporary password to log in and then change password
Log out and log in using a new password