CentOS 6.2 to upgrade the installation to MySQL 5.5

  • 2020-05-10 23:18:12
  • OfStack

It was a painful upgrade.

Complete steps:

1. Back up your data first. You won't lose your data after a successful upgrade, but be on the safe side.

sqldump -u xxx -h xxx -P 3306 -p --all-databases > databases.sql

It is best to make a backup copy of the data file and configuration file.

cp -R /data/mysql mysql-5.1-data

cp /etc/my.cnf my.cnf-5.1

Stop the mysql service after the backup is done.

service mysqld stop

All right, let's get down to business.

2. Uninstall the old version of Mysql

yum remove mysql mysql-*

After execution, see if there are any mysql-libs or something like that

yum list installed | grep mysql

If so, you can delete it after confirming that it is not used.

yum remove mysql-libs

Note that removing mysql-libs may affect some dependent software, which we will not discuss here.

Ok, the uninstall is almost over.

3. Install Mysql5. 5

If you're not lazy, it might be better to compile and install,

Here we discuss the process of installing with yum.

After many detours of N, I found it necessary to install some new repo first.

rpm -Uvh http://download.Fedora.RedHat.com/pub/epel/6/i386/epel-release-6-2.noarch.rpm

rpm -Uvh http://mirrors.neusoft.edu.cn/epel/6/i386/epel-release-6-7.noarch.rpm

rpm -Uvh http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/x86_64/epel-release-6-5.noarch.rpm

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

This time you run again:

yum --enablerepo=remi,remi-test info mysql mysql-server

You will find that the version of mysql is already 5.5.x. Don't hesitate to install it.

yum --enablerepo=remi,remi-test install mysql mysql-server

The installation ends here. Next comes the boot and upgrade.

4. Start and upgrade

When you want to launch 10 directly, 89 errors will be reported. There are two main problems: 1 is the configuration file. Some configuration names have been changed in 5.5 compared with 5.1. 2 is mysql_upgrade not executed.

Run after making sure the configuration file is ok:

mysql_upgrade -u root -p

Wait for all of his ok.

Try running mysql again.

service mysqld start

May god bless what you see is green [ok]


Related articles: