Msyql is abnormal, don’t worry, you can understand it here

In performance testing, database performance problems may account for 70%, so when it comes to performance testing, database is a very, very important knowledge. However, when talking about the MySQL database recently, I encountered an embarrassment.

In our class, all students need to install the MySQL database by hand. Although there are many installation methods, using the yum command to install is something that every student must master. Therefore, when I am in class, I use the yum command that was common in previous classes To install mysql5.7 version

wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum install mysql-community-server -y

As a result, the execution result told me that the installation failed:

If you want to learn automated testing, here I recommend a set of videos for you. This video can be said to be the number one automated testing tutorial on the entire network at station B. At the same time, the number of people online has reached 1,000, and there are notes to collect and share with you. Dashen Technical Exchange: 798478386   

[Updated] The most detailed collection of practical tutorials for automated testing of Python interfaces taught by station B (the latest version of actual combat)_哔哩哔哩_bilibili [Updated] The most detailed collection of practical tutorials for automated testing of Python interfaces taught by station B (actual combat) The latest version) has a total of 200 videos, including: 1. Why should interface automation be done in interface automation, 2. The overall view of request in interface automation, 3. Interface combat in interface automation, etc. UP hosts more exciting videos, please pay attention to UP account . icon-default.png?t=N7T8https://www.bilibili.com/video/BV17p4y1B77x/?spm_id_from=333.337 

It used to be able to install successfully, but now it can't be installed life and death.

what happened?

As a result, I found this:

picture

What do you mean by that? That is to say, on January 18, 2022, MySQL released version 5.7.37 and updated the secret key. The original secret key can only be supported until February 16, 2022. That is to say, if you do not pay attention to this information, you MySQL may not work properly after February 16, 2022.

Using the yum command to install, it will install the latest mysql5.7.37 version, but the key is wrong and the installation is unsuccessful.

Now, the problem arises, how to solve this problem?

Tips: The following methods are all new installations of MySQL, so I don’t need to do database backups. If you read this article after February 16, 2022, or your MySQL database has problems, please do it first Good database backup. form good habit.

  • **Method 1:** Uninstall the noarch package of mysql57, install the noarch package of mysql80, and obtain the secret key

First, uninstall the installed "mysql57-community-release"

 

  • **Method 1:** Uninstall the noarch package of mysql57, install the noarch package of mysql80, and obtain the secret key

First, uninstall the installed "mysql57-community-release"

rpm -e mysql57-community-release

Then, install mysql80-community-release

wget https://dev.mysql.com/get/mysql80-community-release-el7-5.noarch.rpm
rpm -Uvh mysql80-community-release-el7-5.noarch.rpm

Because what we want to install is the mysql5.7 version, not mysql8, so we need to modify the default MySQL version installed by yum at this time.

# yum repolist all | grep mysql   
# 这个命令,可以查看当前,默认的mysql版本,其结果中的启用,就是默认的版本

# 方法一:
yum-config-manager --disable mysql80-community
yum-config-manager --enable mysql57-community
# 这个方法简单,但是,有些系统,没有yum-config-manager命令

# 方法二:
vim /etc/yum.repos.d/mysql-community.repo

[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch
enabled=0  # 把这个改为1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/7/$basearch
enabled=1  # 把这个改为0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

# enable为0 代表禁用, 1代表启用
# 修改保存后,再次执行 yum repolist all | grep mysql 就能看到现在默认mysql的版本是57

After completing the above operations, you can install mysql57 directly

yum install mysql-community-server -y

 Are you happy to see this picture, perfect solution, mysql5.7.37 version, installed successfully.

  • **Method 2: **Use the noarch package of mysql80, get the key, and then install mysql57

The difference between this method and the first method is that the step of uninstalling mysql57-community-release is less.

  • **Method 3: **Use the key of mysql80 to replace the current key

Upload the 'RPM-GPG-KEY-mysql-2022' 'RPM-GPG-KEY-mysql' file to the /etc/pki/rpm-gpg path.

Then, modify the mysql-community.repo configuration file

# 方法一:
yum-config-manager --disable mysql80-community
yum-config-manager --enable mysql57-community
# 这个方法简单,但是,有些系统,没有yum-config-manager命令

# 方法二:
vim /etc/yum.repos.d/mysql-community.repo

[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch
enabled=0  # 把这个改为1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
       file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

# enable为0 代表禁用, 1代表启用

Next, it is directly installed

yum install mysql-community-server -y

ok, perfect solution, three methods, I can do it in practice, have you encountered the above problems, if you do, hurry up and try it!

Guess you like

Origin blog.csdn.net/m0_73409141/article/details/132715592