Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.
Mysql: mysql5.7.35
Server information: Aliyun CentOS 8
1. Stop mysql service first (if no mysql service is started, skip it)
Close command:
systemctl stop mysqld.service
Copy the code
Other common commands:
Service Run the following command to enable mysqld.service: systemctl start mysqld.service Run the following command to enable mysqld.service: service mysqld restart
2. View the installed mysql information
rpm -qa|grep -i mysql
Copy the code
Mysql Installation Information
mysql-community-client-5.735.-1.el7.x86_64
mysql-community-common-5.735.-1.el7.x86_64
mysql80-community-release-el7-3.noarch
mysql-community-server-5.735.-1.el7.x86_64
mysql-community-libs-5.735.-1.el7.x86_64
Copy the code
3. Delete mysql services
You need to run all the queried service names to delete the mysql service
Example: RPM -e --nodeps mysql related services run the RPM -e --nodeps mysql-community-client- command5.735.-1.el7.x86_64
rpm -e --nodeps mysql-community-common-5.735.-1.el7.x86_64
rpm -e --nodeps mysql80-community-release-el7-3.noarch
rpm -e --nodeps mysql-community-server-5.735.-1.el7.x86_64
rpm -e --nodeps mysql-community-libs-5.735.-1.el7.x86_64
Copy the code
< span style = “max-width: 100%; clear: both; min-height: 1em
4. Delete legacy mysql files and dependency information
Example Query legacy files and dependencies of mysql
find / -name mysql
Copy the code
Delete legacy files and dependencies
rm -rf /var/lib/mysql
Copy the code
5. Manually delete the mysql configuration file
rm -rf /etc/my.cnf
Copy the code
Check whether mysql was deleted successfully
rpm -qa|grep -i mysql
Copy the code
If no information is displayed, mysql is uninstalled successfully