MySQL Version Upgrade in Redhat/CentOS from 5.1 to latest

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.

 

 

      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.

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

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

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

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

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

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

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

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

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

    1. Hi!

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

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

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

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

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

  11. Pingback: Imc9AElKLy

Comments are closed.