Table of contents
1 Uninstall the original mysql (mariadb)
1 Uninstall the original mysql (mariadb)
rpm -qa | grep mysql(mariadb) | xargs yum -y remove
(The role of xargs is to feed the results displayed earlier to the following commands one by one)
2 download yum
Download to desktop and then rz
One-click installation of yum source for yum (el -- means centos)
3 to see if it works
yum list |grep mysql
4 Install mysql service
yum install -y mysql-community-server
(If you report an error at this time: Failing package is: mysql-community-client-5.7.39-1.el7.x86_64GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY -mysql solution: rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022)
With these three, it means that the installation is complete.
5 Start the service
systemctl start mysqld.service
Netstat -nltp can show mysql
(If it fails to start, follow the prompts to check online)
6 Login method
vim /etc/my.cnf # Open the mysql configuration file
Configure in the last column of [mysqld] (I don’t know what it is, just put it at the end of the configuration file) Add: skip-grant-tables option, save and exit (set password-free login)
Then systemctl restart mysqld.service
Then
That's it! (quit exit)