In Linux, The MySQL5.7.18 yum method is illustrated from uninstallation to installation, and mysql5.7.18yum
After a long time, I thought about it and thought about it. I finally figured out the yum installation process. I wrote about Binary Package installation before. Here I installed yum in the same environment, centos7.2 + MySQL5.7.18.
I have referenced many articles in each step, which will be listed later. Because the local machine has been installed, simply uninstall it step by step and then reinstall it.
This article is implemented through a series of relative shanzhai methods. It is easier to understand and accept users who are not familiar with linux for a long time, just like me, for example, you can directly download files under Windows and drag them to the linux system instead of using the wget command to download them. You can directly use the Edit function of the winscp editor instead of editing the vim command.
Uninstall
Operating system version
Rpm-qa | grep-I mysql command to view installed components.
Run the yum-y remove command to uninstall the MySQL components that have been installed. Run the following command to uninstall the components separately,
yum -y remove mysql-community-libs-5.7.18-1.el7.x86_64yum -y remove mysql-community-common-5.7.18-1.el7.x86_64yum -y remove mysql-community-client-5.7.18-1.el7.x86_64yum -y remove mysql57-community-release-el7-10.noarchyum -y remove mysql-community-server-5.7.18-1.el7.x86_64
If there are too many images, we will not intercept them. Here is an example.
Run rpm-qa | grep-I mysql again to check the installed components.
Whereis mysql queries the directories generated before installation and removes them respectively.
Install
Download the MySQL repo source. As for what this file does, I personally understand that it will automatically help you configure the yum source for MySQL installation components.
This file can be downloaded under Windows, uploaded to the linux server, or directly downloaded on the linux server. It also needs to be installed.
After Downloading this file, use winscp to drag it to the root directory of the linux server.
Files downloaded in Linux
Install the MySQL repo package
rpm -ivh mysql57-community-release-el7-10.noarch.rpm
There will be some simple tips in the middle. After Entering Y, everything will be fully automated.
yum install mysql-community-server
Installation Complete
Modify the Root initial password
After installation, a file my. cnf is generated under etc, and a skip-grant-tables = 1 configuration is added to my. cnf to skip the initialization password verification requirements.
Systemctl start mysql Service
Connect to the MySQL service. Because the password skipping requirements are configured, enter mysql-u-p and press Enter. When prompted, continue to press enter to connect to mysql.
Modify the Root password of MySQL
update user set authentication_string=PASSWORD('newpassword') where User='root';
Use this statement to Modify remote access for root users. update user set host = '%' where user = 'root'
After restart, you can use a pre-made password to log on to MySQL.
The whole process is relatively simple. If you are familiar with it, that is, a few minutes.
It may not take long for me to make such a round of effort, but I am not familiar with it. I tried it while I tried it. It would be much easier if someone gave me some guidance or thought about it.