Place of all tech articles

techarticles

  • Home
  • About
  • Contact Info

MySQL Version Upgrade in Redhat/CentOS from 5.1 to latest

17th January, 2014 · techinf1 23 Comments

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.

    1. Check the version of mysql
      mysql –version
      mysql_version_check
    2. Check the version of Operating System
      uname -a
      os_version_checkRed circle means Redhat 6 and blue circle means 64 bit machine.

 

  • 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 :

 

      1. MySQL-server-5.6.15-1.el6.x86_64.rpm
      2. MySQL-client-5.6.15-1.el6.x86_64.rpm
      3. MySQL-shared-compat-5.6.15-1.el6.x86_64.rpm
      4. 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.
mysql_rpm_download
For 32 bit machine the packages would be

      1. MySQL-server-5.6.15-1.el6.i686.rpm
      2. MySQL-client-5.6.15-1.el6.i686.rpm
      3. MySQL-shared-compat-5.6.15-1.el6.i686.rpm
      4. 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
    mysql_shutdown
  • 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
    mysql_rpm_query
  • 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
    1. rpm -e MySQL-python-1.2.3-0.3.c1.1.el6.x86_64
    2. rpm -e mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
    3. rpm -e mysql-bench-5.1.52-1.el6_0.1.x86_64
    4. rpm -e mod_auth_mysql-3.0.0-11.el6_0.1.x86_64
    5. 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

 

  1. rpm -Uvh MySQL-shared-compat-5.6.15-1.el6.x86_64.rpm
  2. rpm -UvhMySQL-client-5.6.15-1.el6.x86_64.rpm
  3. rpm -Uvh MySQL-server-5.6.15-1.el6.x86_64.rpm
  4. 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.

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)

Related

Posted in Database, MySQL | Tags: database, mysql |
Connect oracle database from php in Redhat/CentOS »

23 thoughts on “MySQL Version Upgrade in Redhat/CentOS from 5.1 to latest”

  1. zillur says:
    January 18, 2014 at 8:57 pm

    Excellent Article

    Reply
  2. Ken says:
    February 9, 2014 at 12:08 am

    I agree with Zillur. This info is very helpful.

    Reply
  3. billigste mobilabonnement says:
    February 12, 2014 at 9:03 pm

    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.

    Reply
    • Admin says:
      February 13, 2014 at 9:21 pm

      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

      Reply
  4. a-kasser i danmark says:
    February 17, 2014 at 11:49 am

    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!

    Reply
  5. sammenlign mobilabonnement says:
    March 8, 2014 at 12:41 pm

    This post is invaluable. When can I find out more?

    Reply
    • Admin says:
      March 8, 2014 at 12:48 pm

      Hi!
      If you have further question please leave a comment. I will try to answer.

      Reply
  6. billig mobilabonnement says:
    March 8, 2014 at 8:21 pm

    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.

    Reply
  7. http://snurl.com/ says:
    March 11, 2014 at 2:09 pm

    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!

    Reply
    • Admin says:
      March 11, 2014 at 8:31 pm

      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

      Reply
  8. mobilselskaber says:
    March 11, 2014 at 2:09 pm

    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.
    . . . . .

    Reply
  9. billigste mobilabonnement says:
    March 16, 2014 at 2:31 am

    Asking questions are truly nice thing if you are not understanding
    anything entirely, except this post gives pleasant understanding yet.

    Reply
  10. a kassen says:
    March 16, 2014 at 2:32 am

    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!

    Reply
  11. xen vps plans says:
    March 29, 2014 at 1:06 am

    I ѵisited various blogs but tҺe audio feature foг auԀio songs
    current at this website is truly wonderful.

    Reply
    • Admin says:
      March 29, 2014 at 2:45 am

      Hi!

      My site doesn’t have any audio songs . May be you mistakenly made this comment. However, thanks for visiting my blog

      Reply
  12. casino spill says:
    April 4, 2014 at 5:39 am

    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

    Reply
  13. Admin says:
    April 4, 2014 at 3:00 pm

    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.

    Reply
  14. netticasino says:
    April 6, 2014 at 7:50 pm

    Saved as a favorite, I really like your website!

    Also visit my web-site; netticasino

    Reply
  15. casinospel says:
    April 10, 2014 at 3:47 am

    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

    Reply
  16. spilleautomater pa nett says:
    April 10, 2014 at 10:38 am

    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

    Reply
  17. Pingback: Imc9AElKLy

  18. openvz vps plans says:
    April 16, 2014 at 9:11 am

    Wonderful article! Wе will be linking to this great content
    on our websitе. Keep up thе good writiոg.

    Reply
  19. kolikkopelit netissa says:
    April 20, 2014 at 9:28 am

    I was able to find good information from your content.

    Take a look at my blog: kolikkopelit netissa

    Reply

Leave a Reply Cancel reply

Android App to challenge math ability
MathQuiz

Top Posts

  • Optimize MySQL table_open_cache
  • Optimize MySQL query_cache_size
  • Install OCI8 on CentOS/Redhat/Fedora
  • Optimize MySQL tmp_table_size
  • Recover MySQL 5.7 root Password in Redhat/CentOS 7

Recent Posts

  • Recover MySQL 5.7 root Password in Redhat/CentOS 7
  • SSH login without password in Linux
  • How to write automated FTP script in Linux
  • Installing Nginx with PHP support
  • How to access HTML5 local storage

Follow US

Follow US

Categories

© Techinfobest is the house of tech articles
  • About
  • aStore
  • Contact Info
  • google pagerank checker
  • SEO Keyword Rank
  • SEO Page Audit
  • Tools
  • whois