MySQL Version Upgrade in Redhat/CentOS from 5.1 to latest
If you follow traditional procedure for “MySQL Version Upgrade in Redhat/CentOS from 5.1 to latest” , you need a lot of time and patience. You have to upgrade current version to next version and so on to reach the final desired version. But follow the simple, first method for “MySQL Version Upgrade in Redhat/CentOS from 5.1 to latest”. This procedure will work not only from version 5.1 to latest but also from all versions.
- Download the latest version according to server OS and architecture from http://dev.mysql.com/downloads/mysql/ and choose Red Hat Enterprise Linux
At the time of writing the blog the latest version is 5.6.15. Earlier version of MySQL you can download from http://downloads.mysql.com/archives/community/. You need to download only four packages :
- MySQL-server-5.6.15-1.el6.x86_64.rpm
- MySQL-client-5.6.15-1.el6.x86_64.rpm
- MySQL-shared-compat-5.6.15-1.el6.x86_64.rpm
- MySQL-devel-5.6.15-1.el6.x86_64.rpm
In the below image from MySQL website, red circle(5.6.15) indicates MySQL version , blue circle(x86,64-bit) indicates server architecture model and black circle indicates Redhat/CentOs version.
For 32 bit machine the packages would be
- MySQL-server-5.6.15-1.el6.i686.rpm
- MySQL-client-5.6.15-1.el6.i686.rpm
- MySQL-shared-compat-5.6.15-1.el6.i686.rpm
- MySQL-devel-5.6.15-1.el6.i686.rpm
- Take a full backup of the database
mysqldump -u root –all-databases –lock-all-tables –routines -u root -p > backup.sql
*For more safely upgradation , dump all databases except mysql( holds user ,performance and system variables) . Because if there is a huge version gap between original version and upgraded version , some unexpected problem may occur. Problem is that you will be required to create all users and permissions again. Run the following command to take backup all databases except mysql
mysqldump -u root –databases database1 database2–lock-all-tables –routines -u root -p > backup.sql
- Shutdown MySQL daemon
/etc/init.d/mysqld stop
- Move current /etc/my.cnf file to /etc/my.cnf.back
mv /etc/my.cnf /etc/my.cnf.back
- Query the current installed RPM.
Here we upgrade MySQL version 5.1.52 to 5.6.15
rpm -qa | grep -i mysql
- Remove all packages except
- mysql-libs-5.1.52-1.el6_0.1.x86_64
- perl-DBD-MySQL-4.013-3.el6.x86_64
- php-mysql-5.3.3-3.el6_1.3.x86_64
- Removing Packages as following order
- rpm -e MySQL-python-1.2.3-0.3.c1.1.el6.x86_64
- rpm -e mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
- rpm -e mysql-bench-5.1.52-1.el6_0.1.x86_64
- rpm -e mod_auth_mysql-3.0.0-11.el6_0.1.x86_64
- rpm -e mysql-test-5.1.52-1.el6_0.1.x86_64
mysql-libs-5.1.52-1.el6_0.1.x86_64 is actully a client library and many packages depend on it. When you install MySQL-shared-compat-5.6.15-1.el6.i686.rpm the library will be updated . Don’t need to remove dependent package . But sometimes , it may happen that you can’t install MySQL-shared-compat due to conflicting with library then you need to remove mysql-libs-5.1.52-1.el6_0.1.x86_64. Before that you must remove perl-DBD-MySQL-4.013-3.el6.x86_64 , php-mysql-5.3.3-3.el6_1.3.x86_64 and any other package that depends on mysql-libs-5.1.52-1.el6_0.1.x86_64. After upgrading mysql you will require to install again perl-DBD( to access MySQL from Perl) and php-mysql ( to access mysql from PHP) .
- Install downloaded packages as following order of commands
- rpm -Uvh MySQL-shared-compat-5.6.15-1.el6.x86_64.rpm
- rpm -UvhMySQL-client-5.6.15-1.el6.x86_64.rpm
- rpm -Uvh MySQL-server-5.6.15-1.el6.x86_64.rpm
- rpm -Uvh MySQL-devel-5.6.15-1.el6.x86_64.rpm
- Check the new installed version
mysql –version
- Copy a sample my.cnf file and configure necessary mysql parameters.
cp /usr/share/mysql/my-default.cnf /etc/my.cnf
- Start MySQL server with new version
/etc/init.d/mysql start
After upgraded to version 5.6.15 mysql instance has changed from mysqld to mysql. So now you need to stop,start or restart MySQL by /etc/init.d/mysql command.
try to access mysql without password
mysql
if you get error “Access denied for user ‘root'” then stop MySQL(/etc/init.d/mysql stop) and start it in safe mode
start mysql in safe mode to change password
mysqld_safe –skip-grant-tables &
Now you can access without password. Change the password as required
mysql> use mysql;
mysql> update user set password=PASSWORD(‘your root password’) where user=’root’;
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
Stop MySQL server again (/etc/init.d/mysql stop) and start again (/etc/init.d/mysql start)
Try to access now using your password
mysql -u root -p
If you get the following error after accessing
mysql> use mysql;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
run the following command
mysql> set password=PASSWORD(‘your root password’);
Query OK, 0 rows affected (0.00 sec)
- Import the backup you taken before upgradation
mysql -u root -p < backup.sql
Now you should get access using your old password if you have taken fullbackup including mysql database. If face any problem start mysql server in safe mode and change the root password.
If your backup didn’t include mysql database you need to create other again old users and grant permissions.
- For checking uploaded database consistency run the command
mysql_upgrade -u root -p
- For ensure security run the following command and remove anonymous users
mysql_secure_installation
* You can follow the above procedure of “MySQL version upgrade in Redhat/CentOS from 5.1 to latest ” for other version upgrade. As instance , from version 5.5 to 5.6.15.
Excellent Article
I agree with Zillur. This info is very helpful.
Can I simply say what a comfort to find a person that truly knows what they’re
discussing over the internet. You actually realize how to bring a problem to light and make it
important. A lot more people should look at this and understand this side of your story.
I was surprised you aren’t more popular because you most certainly possess the gift.
Thanks for your comment. I try to write article that I have implemented by myself. So this site holds less article. However, in coming days I would write some important article
Great website you have here but I was wanting to
know if you knew of any discussion boards that cover the same topics discussed here?
I’d really love to be a part of group where I can get comments from other experienced people that share
the same interest. If you have any suggestions, please let me know.
Cheers!
This post is invaluable. When can I find out more?
Hi!
If you have further question please leave a comment. I will try to answer.
Hey I know this is off topic but I was wondering if you knew of any widgets
I could add to my blog that automatically tweet my newest twitter
updates. I’ve been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like
this. Please let me know if you run into anything.
I truly enjoy reading your blog and I look forward to your new updates.
You actually make it seem so easy with your presentation but I find this matter to
be really something which I think I would never understand.
It seems too complex and extremely broad for
me. I am looking forward for your next post, I will try to get
the hang of it!
Hi!
Can you tell me which part makes difficult for you?
One things if you install fresh Redhat/Centos with MySQL its version is 5.1 but you need to upgrade just follows two steps
1) delete all rpm as I mentioned
2) Download downloadable RPMs and install
If you install fresh Redhat/Centos without MySQL RPMS it is more easy
1) Download downloadable RPMs and install
Only little complex is you have existing MySQL and you have significant data
Thanks
Howdy very nice blog!! Man .. Excellent .. Amazing .. I’ll bookmark your
website and take the feeds also? I am happy to search out so many useful
information here within the post, we’d like develop
more techniques on this regard, thanks for sharing.
. . . . .
Asking questions are truly nice thing if you are not understanding
anything entirely, except this post gives pleasant understanding yet.
Heya are using WordPress for your blog platform?
I’m new to the blog world but I’m trying to get started and create my own.
Do you need any html coding expertise to make your own blog?
Any help would be greatly appreciated!
I ѵisited various blogs but tҺe audio feature foг auԀio songs
current at this website is truly wonderful.
Hi!
My site doesn’t have any audio songs . May be you mistakenly made this comment. However, thanks for visiting my blog
With havin so much content do you ever run into any problems
of plagorism or copyright violation? My site has a lot of exclusive content
I’ve either written myself or outsourced but it looks like a lot of it
is popping it up all over the internet without my authorization.
Do you know any solutions to help stop content from being stolen?
I’d definitely appreciate it.
Feel free to surf to my site – casino spill
Actually , the ideology of internet is free for all. So except special security type information, company specific or other contents that are solely proprietary , any one can use other website content if that content doesn’t mislead the fact. Like in my site I have written 6 posts all have actually published earlier in different approach. But I have written those articles on my practical experience and believe that will help my reader more to understand.
Saved as a favorite, I really like your website!
Also visit my web-site; netticasino
I feel that is one of the such a lot important information for me.
And i am satisfied reading your article. However
should commentary on some normal issues, The site taste is perfect, the articles is truly nice :
D. Just right process, cheers
Also visit my web site … casinospel
Hi there I am so thrilled I found your site, I really found you
by mistake, while I was looking on Digg for something else,
Anyhow I am here now and would just like to say many thanks for a tremendous post and
a all round thrilling blog (I also love the theme/design), I don’t have time to go through it all at the minute but I have book-marked it
and also added in your RSS feeds, so when I have time I will be back
to read a lot more, Please do keep up the superb job.
My blog: spilleautomater pa nett
Wonderful article! Wе will be linking to this great content
on our websitе. Keep up thе good writiոg.
I was able to find good information from your content.
Take a look at my blog: kolikkopelit netissa