Original: http://lib.csdn.net/article/mysql/4607
First step: Full backup of all databases
[Email protected] mysql]# mysqldump-u root-p--all-database >/data/back_mysql/all-database-04-30.
Step two: After you stop the MySQL service, view the installed MySQL, and then remove it from the following
[Email protected] data]# Rpm-qa | Grep-i MySQL
[Email protected] data]# rpm-e--nodeps mysql-server-5.1.52-1.el6_0.1.x86_64
[Email protected] data]# rpm-e--nodeps mysql-5.1.52-1.el6_0.1.x86_64
[Email protected] data]# rpm-e--nodeps mysql-libs-5.1.52-1.el6_0.1.x86_64
Step three: Check whether the installation location of MySQL is still present, and then delete it, including the my.cnf file
[[email protected] mysql]# Find/-name MySQL
Main database directory/var/lib/mysql, configuration file directory/usr/share/mysql, related command directory/usr/bin, configuration file/etc/my.cnf
These default directories will generally be deleted along with the deletion of the database, remember to be sure to delete the my.cnf, the first time in/USR/SHARE/MY.CNF did not notice, to the pit dead!!
Fourth step: Install MySQL, I here is installed in rpm mode, download the corresponding package on the official website after unpacking only the following three packages
mysql-client-5.6.24-1.linux_glibc2.5.x86_64.rpm
mysql-devel-5.6.24-1.linux_glibc2.5.x86_64.rpm
mysql-server-5.6.24-1.linux_glibc2.5.x86_64.rpm
[Email protected] mysql]# rpm-ivh/data/software/mysql-server-5.6.24-1.linux_glibc2.5.x86_64.rpm
Install in turn
Fifth Step: Modify the configuration file, set up the database storage directory under/data/mysql
[Email protected] etc]# Vi/etc/rc.d/init.d/mysql
DataDir =/data/mysql
[Email protected] software]# VI/ETC/MY.CNF
This is my configuration file.
[Client]
Port = 3306
Socket =/data/mysql/mysql.sock
Default-character-set = Utf8mb4
[MySQL]
Default-character-set = Utf8mb4
Upgrade MySQL support UTF8MB4 character set detailed steps