Complete steps for upgrading and installing MySQL 5.5 in centos 6

Source: Internet
Author: User

Use centos 6.2 system has been installed with MySQL 5.1, but do 5.1 does not support utf8mb4 character set (see: http://blog.csdn.net/shootyou/article/details/8236024), you can only find a way to upgrade MySQL to 5.5.

This is indeed a painful upgrade process.

Complete steps:

1. First, back up the data. Although the upgraded data will not be lost, back up the data as secure as possible.

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

It is best to back up both the data file and configuration file.

cp -R /data/mysql mysql-5.1-datacp /etc/my.cnf my.cnf-5.1

Stop the MySQL service after the backup.

service mysqld stop

Now, start to the topic.

2. Uninstall the old MySQL version.

yum remove mysql mysql-*

After running the command, check whether there are some residual mysql-libs and the like.

yum list installed | grep mysql

If yes, you can delete it after confirming that it is useless.

yum remove mysql-libs

Note that deleting mysql-libs may affect some dependent software. We will not discuss it here.

Now, the unmount operation is basically over.

3. Install mysql5.5

If you are not lazy, it may be better to choose to compile and install, you can refer to: http://my.oschina.net/laiwanshan/blog/72903

Here we will discuss the installation process using yum.

After N detours, I found that some new repo needs to be installed first.

rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpmrpm -Uvh http://mirrors.neusoft.edu.cn/epel/6/i386/epel-release-6-8.noarch.rpmrpm -Uvh http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpmrpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/x86_64/epel-release-6-5.noarch.rpmrpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Then run:

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

The MySQL version is 5.5.x. Do not hesitate to install it.

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

Installation ends. Next, start and upgrade.
4. Start and upgrade

In this case, if you want to directly start the service, an error will be reported. There are two major problems: first, the configuration file, 5.5, and some configuration changes compared with 5.1. You need to make some improvements against the startup error log. Second, mysql_upgrade is not executed.

Run the following command to ensure that the configuration file is correct:

mysql_upgrade -u root -p

Wait until all of them are OK.

Try MySQL again.

service mysqld start

Hope god bless you to see the green [OK].

If you need to upgrade MySQL from centos 5, you can refer to: http://www.ha97.com/4145.html, but this is only applicable to centos 5. At first, I was misled and delayed for half a day.

Other references:

Http://blog.iphoting.com/blog/2012/06/19/upgrading-to-mysql-5-dot-5-on-centos-6/

Http://stackoverflow.com/questions/9361720/update-mysql-version-from-5-1-to-5-5-in-centos-6-2

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.