centos7 mysql5.7 installation method

1. Default yum repository installation

yum -y install wget # Install wget download tool

wget https://repo.mysql.com/mysql57-community-release-el7-11.noarch.rpm # Download mysql official yum source installation package

yum -y localinstall mysql57-community-release-el7-11.noarch.rpm # Install mysql official yum source

2. Select the specified release version to install
When using the MySQL Yum repository, the latest GA version of MySQL to be installed will be selected by default.
The subrepositories for the latest GA series (currently MySQL 8.0) are enabled by default , while those for all other series (for example, the MySQL 5.7 series) are disabled. View enabled or disabled repositories.

1. List all versions

yum repolist all | grep mysql

It is found that the latest version 8.0 is enabled, and version 5.7 is disabled. When version 5.7 needs to be installed, disable version 8.0, and then enable version 5.7

2. Install the yum configuration tool

yum -y install yum-utils

3. Disable version 8.0
yum-config-manager --disable mysql80-community

4. Enable version 5.7
yum-config-manager --enable mysql57-community

5. Check the enabled version
Note: Please ensure that only one version is enabled when installing, otherwise a version conflict will be displayed
yum repolist enabled | grep mysql

2. To install MySQL, you need to install MySQL Server, and the MySQL client is already included in the server package

yum -y install mysql-community-server mysql # install server, client

rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 #Solve the key error and cannot install

systemctl start mysqld # start mysql service

systemctl enable mysqld # Set the mysql service to start at boot

ls /var/lib/mysql # View mysql installation

grep 'tqfeduorary password' /var/log/mysqld.log # Get the first login password

mysql -uroot -p'awm4444>!QFl6zR' # Log in to the mysql database

mysql > alter user 'root'@'localhost' identified by 'adminAd1!'; # Modify the mysql
database password (the password must meet the complexity requirements, including letters, numbers, amnesty symbols, and the length is not less than 8 characters)

mysql -uroot -p 'adminAd1! ' # Log in to the database with the new password

Guess you like

Origin blog.csdn.net/ydaxia110/article/details/131574810
Recommended