Thursday, February 13, 2014

MySQL 5.5 Installation on Centos/RHEL 6.5 via Yum

I've been using RPM every time i will install MySQL server in my Linux boxes. But today i will show you on how to install MySQL 5.5 on Centos 6.5 via Yum.

First, to set up the yum repository, install the webtatic-release RPM based on your CentOS/RHEL release.


[root@localhost ~]# rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
Retrieving http://mirror.webtatic.com/yum/el6/latest.rpm
warning: /var/tmp/rpm-tmp.q3Y9pR: Header V4 DSA/SHA1 Signature, key ID cf4c4ff9: NOKEY
Preparing...                ########################################### [100%]

   1:webtatic-release       ########################################### [100%]



Remove the pre-installed mysql-libs with no dependecy.

[root@localhost ~]# rpm -e  mysql-libs
error: Failed dependencies:
        libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
        libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64
        mysql-libs is needed by (installed) postfix-2:2.6.6-2.2.el6_1.x86_64


[root@localhost ~]# rpm -e  --nodeps mysql-libs

After removing the previous version of mysql-libs you can now start the installation of MYSQL via Yum


[root@localhost ~]# yum install mysql55 mysql55-server

Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: centos.corenetworks.net
 * extras: centos.mirror.freedomvoice.com
 * updates: mirrors.usinternet.com
 * webtatic: sp.repo.webtatic.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql55.x86_64 0:5.5.34-1.w6 will be installed
--> Processing Dependency: mysql55-libs = 5.5.34-1.w6 for package: mysql55-5.5.34-1.w6.x86_64
---> Package mysql55-server.x86_64 0:5.5.34-1.w6 will be installed
--> Processing Dependency: perl-DBI for package: mysql55-server-5.5.34-1.w6.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: mysql55-server-5.5.34-1.w6.x86_64
--> Processing Dependency: perl(DBI) for package: mysql55-server-5.5.34-1.w6.x86_64
--> Running transaction check
---> Package mysql55-libs.x86_64 0:5.5.34-1.w6 will be installed
--> Processing Dependency: libmysqlclient16 for package: mysql55-libs-5.5.34-1.w6.x86_64
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed
---> Package perl-DBI.x86_64 0:1.609-4.el6 will be installed
--> Running transaction check
---> Package libmysqlclient16.x86_64 0:5.1.69-1.w6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================
 Package                                 Arch                          Version                              Repository                       Size
==================================================================================================================================================
Installing:
 mysql55                                 x86_64                        5.5.34-1.w6                          webtatic                        5.5 M
 mysql55-server                          x86_64                        5.5.34-1.w6                          webtatic                         10 M
Installing for dependencies:
 libmysqlclient16                        x86_64                        5.1.69-1.w6                          webtatic                        1.0 M
 mysql55-libs                            x86_64                        5.5.34-1.w6                          webtatic                        778 k
 perl-DBD-MySQL                          x86_64                        4.013-3.el6                          base                            134 k
 perl-DBI                                x86_64                        1.609-4.el6                          base                            705 k

Transaction Summary
==================================================================================================================================================
Install       6 Package(s)

Total download size: 18 M
Installed size: 82 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): libmysqlclient16-5.1.69-1.w6.x86_64.rpm                                                                             | 1.0 MB     00:06
(2/6): mysql55-5.5.34-1.w6.x86_64.rpm                                                                                      | 5.5 MB     00:45
(3/6): mysql55-libs-5.5.34-1.w6.x86_64.rpm                                                                                 | 778 kB     00:05
(4/6): mysql55-server-5.5.34-1.w6.x86_64.rpm                                                                               |  10 MB     01:13
(5/6): perl-DBD-MySQL-4.013-3.el6.x86_64.rpm                                                                               | 134 kB     00:02
(6/6): perl-DBI-1.609-4.el6.x86_64.rpm                                                                                     | 705 kB     00:06
--------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                             130 kB/s |  18 MB     02:22
warning: rpmts_HdrFromFdno: Header V4 DSA/SHA1 Signature, key ID cf4c4ff9: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-andy
Importing GPG key 0xCF4C4FF9:
 Userid : Andy Thompson
 Package: webtatic-release-6-4.noarch (installed)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-webtatic-andy
Is this ok [y/N]: y
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
 Userid : CentOS-6 Key (CentOS 6 Official Signing Key)
 Package: centos-release-6-5.el6.centos.11.1.x86_64 (@anaconda-CentOS-201311272149.x86_64/6.5)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : perl-DBI-1.609-4.el6.x86_64                                                                                                    1/6
  Installing : libmysqlclient16-5.1.69-1.w6.x86_64                                                                                            2/6
  Installing : mysql55-libs-5.5.34-1.w6.x86_64                                                                                                3/6
  Installing : mysql55-5.5.34-1.w6.x86_64                                                                                                     4/6
  Installing : perl-DBD-MySQL-4.013-3.el6.x86_64                                                                                              5/6
  Installing : mysql55-server-5.5.34-1.w6.x86_64                                                                                              6/6
  Verifying  : libmysqlclient16-5.1.69-1.w6.x86_64                                                                                            1/6
  Verifying  : perl-DBD-MySQL-4.013-3.el6.x86_64                                                                                              2/6
  Verifying  : mysql55-libs-5.5.34-1.w6.x86_64                                                                                                3/6
  Verifying  : perl-DBI-1.609-4.el6.x86_64                                                                                                    4/6
  Verifying  : mysql55-5.5.34-1.w6.x86_64                                                                                                     5/6
  Verifying  : mysql55-server-5.5.34-1.w6.x86_64                                                                                              6/6

Installed:
  mysql55.x86_64 0:5.5.34-1.w6                                         mysql55-server.x86_64 0:5.5.34-1.w6

Dependency Installed:
  libmysqlclient16.x86_64 0:5.1.69-1.w6  mysql55-libs.x86_64 0:5.5.34-1.w6  perl-DBD-MySQL.x86_64 0:4.013-3.el6  perl-DBI.x86_64 0:1.609-4.el6

Complete!

After installing, the commands needed to activate it to run at system startup depend on your operating system. On Linux, you can use chkconfig:

[root@localhost ~]# chkconfig --add mysqld

On some Linux systems, the following command also seems to be necessary to fully enable the mysql script:

[root@localhost ~]# chkconfig --level 345 mysqld on

You can now start MySQL as a service.

[root@localhost bin]# service mysqld start
Starting mysqld:                                           [  OK  ]
[root@localhost bin]# ps ax | grep mysql
26597 pts/2    S      0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql
26804 pts/2    Sl     0:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
26836 pts/2    S+     0:00 grep mysql
[root@localhost bin]#








1 comment:

Jeff said...

hi Mike, very help. I'm almost there but getting an error on mysqlclient:

mysql: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory

Any ideas on how to resolve?
Thanks,
Jeff

The On Demand Global Workforce - oDesk
Google