1, first detect whether the system with the original version of the MySQL installation package, if there is to uninstall first delete, otherwise can not be successfully installed and started;
# rpm-qa|grep MySQL to see what packages are installed, if skip directly, indicating that there is no installation package, memory can be directly into the 2nd, 3
# yum Remove MySQL mysql-server mysql-libs compat-mysql51 Note This code, uninstall is not clean
# Rm-rf/var/lib/mysql
# RM/ETC/MY.CNF
# Rpm-qa|grep MySQL to see if you have deleted, did not delete, then delete, but to delete
Such as:
You can see that there are two installation packages
mysql-server-5.6.19-1.linux_glibc2.5.x86_64.rpm
mysql-client-5.6.19-1.linux_glibc2.5.x86_64.rpm
Delete these two services (remove suffix)
# rpm–e mysql-client-5.6.19-1.linux_glibc2.5.x86_64 # rpm-e mysql-server-5.6.19-1.linux_glibc2.5.x86_64
To view the remaining directories:
# Whereis MySQL
And then delete the MySQL directory:
# Rm–rf/usr/lib64/mysql
2, download the MySQL repo source
# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
3. Install MYSQL-COMMUNITY-RELEASE-EL7-5.NOARCH.RPM Package
# RPM-IVH mysql-community-release-el7-5.noarch.rpm
4, install MySQL
#yum Install Mysql-community-server
5. Restart MySQL service after successful installation
#service mysqld Restart
6. Reset Password
# mysql-uroot Mysql>use MySQL; mysql> Update user Set password = password (' 123456 ') where user = ' root '; mysql> flush Privileges; That's a success. Mysql> exit;
Want to know the password in the end right? You can verify that you are exiting to log in again;
# Mysql-uroot-p here must add-p, he will remind you to enter password:
You only need to enter the password you have just set to enter, if you do not go, then you perform 6 and then set it again; I set the password to 123456, after each login to the MySQL root login is: # mysql-uroot-p