Update MySQL version from 5.1 to 5.5 in CentOS 6.2
Solution 1
To list Old MySql
yum list installed | grep -i mysql
To remove Old MySql
yum remove mysql mysql-*
Remi Dependency on CentOS 6 and Red Hat (RHEL) 6
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Install MySQL server
yum --enablerepo=remi,remi-test install mysql mysql-server
To list New MySql
yum list installed | grep -i mysql
start MySql server
/etc/init.d/mysqld start
## use restart after update
OR
service mysqld start
## use restart after update
chkconfig --levels 235 mysqld on
Last
mysql_upgrade -u root -p
Now my MySql version is 5.5.32
Ref:
http://www.webtatic.com/packages/mysql55/
http://www.if-not-true-then-false.com/2010/install-mysql-on-fedora-centos-red-hat-rhel/
Hope it help some one
NOTE: Adding comments from @pim (in comments)
Just wanted to add that after the upgrade, my crontab was removed as well. Had to reinstall with "yum install vixie-cron" (CentOS 6)
Solution 2
I used the following commands to add a new YUM repo and make the update:
Download the Remi repo
cd /etc/yum.repos.d
wget http://rpms.famillecollet.com/enterprise/remi.repo
Install/Update the mysql version
yum --enablerepo=remi install mysql-server
OR
yum --enablerepo=remi update mysql-server
Solution 3
2015/08/19 - For those of you working on older (but still decent) hardware with a matching OS (typically 32 bit machines).
-- This will upgrade to mysql 5.6 community not 5.5 --
This worked for me after some research and mixing/matching/testing the answers found on various page of the internet (mainly from this page and http://dev.mysql.com/doc/refman/5.6/en/linux-installation-yum-repo.html). My OS shipped with mysql 5.1, I wanted to have 5.6.
My system
[root@host]# cat /etc/*release
CentOS release 6.7 (Final)
[root@host]# uname -a
Linux host 2.6.32-573.3.1.el6.i686 #1 SMP Thu Aug 13 19:58:36 UTC 2015 i686 i686 i386 GNU/Linux
[root@host]# arch
i686
This is installed on a 2006 mac pro 1.1 (CPUs upgraded to 3.0GHz Intel Xeon X5365 Quad-Core).
Commands I ran
This was done almost immediately after a fresh install of the OS and system update via yum
list mysql currently installed
yum list installed | grep -i mysql
remove installed msql
yum remove mysql mysql-*
list mysql currently installed
yum list installed | grep -i mysql
Download rpm containing mysql 5.6
wget http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
Install mysql
rpm -Uvh mysql-community-release-el6-5.noarch.rpm
yum install mysql mysql-server
list mysql currently installed
yum list installed | grep -i mysql
ensure mysql starts on reboot
chkconfig --list mysqld
sudo chkconfig mysqld on
chkconfig --list mysqld
Start mysql
service mysqld start
service mysqld status
Result
[root@host]# yum list installed | grep -i mysql
compat-mysql51.i686 5.1.54-1.el6.remi @remi
mysql-community-client.i686
5.6.26-2.el6 @mysql56-community
mysql-community-common.i686
5.6.26-2.el6 @mysql56-community
mysql-community-libs.i686
5.6.26-2.el6 @mysql56-community
mysql-community-release.noarch
mysql-community-server.i686
5.6.26-2.el6 @mysql56-community
perl-DBD-MySQL.i686 4.013-3.el6 @base
[root@host]# mysql --version
mysql Ver 14.14 Distrib 5.6.26, for Linux (i686) using EditLine wrapper
mysql config (I did not touch this yet but the info seems legit)
Some interesting basic but efficient performance tuning for mysql:Good luck!
Edit
I had some issues creating users and granting permissions, this how it was fixed.
Error
ERROR 1054 (42S22) at line 1: Unknown column 'plugin' in 'mysql.user'
Fix
- Logged on the server as root
- Connected to mysql with a simple
mysql
- Checked the outcome of this statement:
SELECT COUNT(1) column_count FROM information_schema.columns WHERE table_schema='mysql' AND table_name='user';
The result was 39, 43 is expected for mysql 5.6 - Issued this statement to update the root password:
update mysql.user set Password=PASSWORD('root') where User='root';
- (Logged off mysql with
exit
) - Restarted mysql with:
service mysqld restart
- Ran:
mysql_upgrade -uroot -proot --force
- Reconnected to mysql with
mysql -uroot -proot
- Checked the outcome of this statement:
SELECT COUNT(1) column_count FROM information_schema.columns WHERE table_schema='mysql' AND table_name='user';
The result was 43 as expected for mysql 5.6. I was then able to create my users and grant permissions as needed.
Solution 4
You appear to have been using the wrong Webtatic Yum repository version than the one for your version of CentOS. See http://www.webtatic.com/projects/yum-repository/ for details
e.g.
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
You can use a yum plugin made by the IUS community to switch mysql-libs with mysql55w-libs. (the following assuming you still use Webtatic)
yum install mysql yum-plugin-replace
yum replace mysql --replace-with mysql55w
That should allow you to replace mysql with mysql55w-libs, whilst maintaining the older libmysqlclient for any dependencies.
If you see other packages than mysql being removed, then be careful, as they might be needed, but using this method, I've found to be reliable whenever I've used it.
I'm posting this solution as Remi's repository is not always the ideal solution. This method is more complex, but would never cause you to accidentally update your entire web stack by using repositories that use package names matching base distribution packages.
Solution 5
Above replies didn't work for me (got this error - error: /var/tmp/rpm-tmp.tyukGy: not an rpm package).
I followed these steps -
## Remove existing/old MySQL ##
yum remove mysql mysql-*
rm -rf /var/lib/mysql
rm -rf /var/log/mysql*
## Install Remi Repository on RHEL/CentOS 6.7-6.0 ##
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
## Install Remi Repository on RHEL/CentOS 5.4-5.0 ##
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
yum --enablerepo=remi list mysql mysql-server
yum --enablerepo=remi install mysql mysql-server
Taken from - http://www.tecmint.com/install-mysql-on-rhel-centos-6-5-fedora-17-12/
By doing above, i uninstalled MySQL 5.0.* and replaced it with this -
[root@localhost]# /usr/bin/mysqladmin -u root -p version
/usr/bin/mysqladmin Ver 8.42 Distrib 5.5.28, for Linux on x86_64
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Server version 5.5.28
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 32 sec
Threads: 1 Questions: 3 Slow queries: 0 Opens: 33 Flush tables: 1 Open tables: 26 Queries per second avg: 0.093
[root@localhost]#
My CentOS version -
[root@localhost]# cat /etc/redhat-release
CentOS release 6.3 (Final)
[root@localhost]# uname -a
Linux localhost.localdomain 2.6.32-279.14.1.el6.x86_64 #1 SMP Tue Nov 6 23:43:09 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Dilip Rajkumar
I like to code in Java, Struts2 and iPhone.... Advanced Web2.0 JS coding.. Very Cool... Happy Coding..:) Cheers
Updated on March 02, 2020Comments
-
Dilip Rajkumar about 4 years
I tried to update MySQL from 5.1 to 5.5 in CentOS 6.2. The following is the process I did:
1. rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm 2. yum install libmysqlclient15 --enablerepo=webtatic 3. yum remove mysql mysql-* 4. yum install mysql55 mysql55-server --enablerepo=webtatic
When I tried the 4th step, I got the following output:
[root@d2005 /]# yum install mysql55 mysql55-server --enablerepo=webtatic Failed to set locale, defaulting to C Loaded plugins: fastestmirror, presto Loading mirror speeds from cached hostfile * base: yum.singlehop.com * extras: centos.mirrors.tds.net * updates: pubmirrors.reflected.net Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package mysql55.x86_64 0:5.5.10-1.w5 will be installed --> Processing Dependency: mysql55-libs = 5.5.10-1.w5 for package: mysql55-5.5.10-1.w5.x86_64 ---> Package mysql55-server.x86_64 0:5.5.10-1.w5 will be installed --> Processing Dependency: perl-DBD-MySQL for package: mysql55-server-5.5.10-1.w5.x86_64 --> Running transaction check ---> Package mysql55-libs.x86_64 0:5.5.10-1.w5 will be installed ---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed --> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: perl-DBD-MySQL-4.013-3.el6.x86_64 --> Processing Dependency: libmysqlclient.so.16()(64bit) for package: perl-DBD-MySQL-4.013-3.el6.x86_64 --> Running transaction check ---> Package mysql-libs.x86_64 0:5.1.61-1.el6_2.1 will be installed --> Processing Conflict: mysql55-libs-5.5.10-1.w5.x86_64 conflicts mysql-libs < 5.5.10 --> Finished Dependency Resolution Error: mysql55-libs conflicts with mysql-libs You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest
How to fix it?
-
Drahcir over 11 yearsNo Problem, I had to make the upgrade yesterday and didn't want to uninstall the old version. Uninstalling it via yum prompted me to also uninstall the depending packages like php-mysql and phpMyAdmin, so this way I was able to just update without uninstalling first. Hope it helps someone.
-
Toddius Zho over 11 yearsI'm getting the same problem as the OP. Instead of upgrading mysql-libs to the latest version, it believes mysql55-libs and mysql-libs are unrelated and conflict with one another. If you remove the previous versions of MySQL first, will that zap your datadir, ibdata1, /etc/my.cnf, logs, etc. and/or directory structures in general?
-
Dilip Rajkumar over 11 yearsI forgot for what server I did this... You should take the backup of databases you have also log you have.. I dont think you will have them after you upgrade...
-
Toddius Zho over 11 yearsI am going to try these steps tonight. I will see if yum's
replace
combined with--replace-with
will let me skipyum remove
. -
Dilip Rajkumar over 11 yearsOk.. if it succeed please add your answer to this question.. that will sure help others...
-
paimoe over 11 yearsWorked great for me after failing with the
mysql-libs
clash -
tftd about 11 yearsyou should note doing
rm -rf /var/lib/mysql
WILL remove all databases. -
Dilip Rajkumar almost 11 yearsThank you Andy, this is old answer, the repo urls could be wrong.. Thank you once again for giving us the correct url..:)
-
Toddius Zho almost 11 yearsI had trouble with the libraries again and used
yum upgrade mysql55-libs --downloadonly; rpm -e mysql-libs --nodeps; rpm -Uvh /var/cache/yum/<REPO>/mysql55-libs;
, where <REPO> is whatever repo you downloaded the package from. -
sactiw almost 11 yearsEdited link download.fedora.redhat.com has been an alias in DNS for link dl.fedoraproject.org and is no more valid. The 'yum' command should install and not just list the package files. Also, added suggestion to look at current mysql installation, if any, before updating it.
-
Stony about 10 yearsUpgrade mysql to 5.5.37, and needn't backup database at all. Just let others guy know.
-
dockeryZ about 10 yearsWorked a treat, but for some reason my phpinfo isn't showing the upgrade, yet phpmyadmin does.
-
jesse cai almost 10 yearsCould not retrieve mirrorlist rpms.famillecollet.com/enterprise/latest/remi/mirror error was 14: PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" Error: Cannot find a valid baseurl for repo: remi
-
nodeffect over 8 yearsI think this is the best answer. It's easy and it works! +1
-
Pim over 8 yearsI was a little hesitant because I was doing this on a live server, but the above instructions work perfectly. I would first add the Remi Dependency and then remove the old MySQL server, saves you a few seconds :) Bottomline: all it took was about 1 minute of downtime, the MySQL data was still present and after the update (from 5.1.73 to 5.5.47), the site ran perfectly again.
-
Pim over 8 yearsJust wanted to add that after the upgrade, my crontab was removed as well. Had to reinstall with "yum install vixie-cron" (CentOS 6)
-
Dan Horvat over 8 yearsNo good. The part where you're removing the old mysql removed much more than just mysql. Had to reinstall the server.
-
t q about 7 yearsNow
plesk
doesnt work! im missingplesk-mysql-server.x86_64
andmysql-connector-odbc.x86_64
was missing, reinstalled it but still on5.1
-
Admin over 6 yearsThanks a lot. @Drahcir