Skip to content

How to Install Newest MySQL on CentOS 6 from Official Repository

  • by
  • March 26, 2014July 10, 2020
If you plan to install the newest MySQL on CentOS 7, you may refer to another post below:
How to Install Newest LAMP on CentOS 7 Minimal (1/3) - MySQL

First of all, we should install a specific Yum repository from MySQL website:
[root@example ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)
[root@example ~]# rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
Retrieving http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
Preparing...                ########################################### [100%]
   1:mysql-community-release########################################### [100%]
[root@example ~]# rpm -q mysql-community-release
mysql-community-release-el6-5.noarch

For other Linux distros or releases, please refer to http://dev.mysql.com/downloads/repo/

Next, we can check the result by listing all enabled repos.
[root@example ~]# yum repolist
...
repo id                    repo name                                      status
...
mysql-connectors-community MySQL Connectors Community                          5
mysql-tools-community      MySQL Tools Community                               5
mysql56-community          MySQL 5.6 Community Server                         31
...

Let's install mysql-community-server.
[root@example ~]# yum install mysql-community-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.ash.fastserv.com
 * extras: mirror.metrocast.net
 * updates: mirror.trouble-free.net
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.6.16-1.el6 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.6.16-1.el6 for package: mysql-community-server-5.6.16-1.el6.x86_64
--> Processing Dependency: mysql-community-client(x86-64) = 5.6.16-1.el6 for package: mysql-community-server-5.6.16-1.el6.x86_64
--> Processing Dependency: perl(warnings) for package: mysql-community-server-5.6.16-1.el6.x86_64
--> Processing Dependency: perl(strict) for package: mysql-community-server-5.6.16-1.el6.x86_64
--> Processing Dependency: perl(if) for package: mysql-community-server-5.6.16-1.el6.x86_64
--> Processing Dependency: perl(Sys::Hostname) for package: mysql-community-server-5.6.16-1.el6.x86_64
--> Processing Dependency: perl(POSIX) for package: mysql-community-server-5.6.16-1.el6.x86_64
--> Processing Dependency: perl(Getopt::Long) for package: mysql-community-server-5.6.16-1.el6.x86_64
--> Processing Dependency: perl(File::Temp) for package: mysql-community-server-5.6.16-1.el6.x86_64
--> Processing Dependency: perl(File::Spec) for package: mysql-community-server-5.6.16-1.el6.x86_64
--> Processing Dependency: perl(File::Path) for package: mysql-community-server-5.6.16-1.el6.x86_64
--> Processing Dependency: perl(File::Copy) for package: mysql-community-server-5.6.16-1.el6.x86_64
--> Processing Dependency: perl(File::Basename) for package: mysql-community-server-5.6.16-1.el6.x86_64
--> Processing Dependency: perl(Fcntl) for package: mysql-community-server-5.6.16-1.el6.x86_64
--> Processing Dependency: perl(Data::Dumper) for package: mysql-community-server-5.6.16-1.el6.x86_64
--> Processing Dependency: perl(DBI) for package: mysql-community-server-5.6.16-1.el6.x86_64
--> Processing Dependency: /usr/bin/perl for package: mysql-community-server-5.6.16-1.el6.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.6.16-1.el6 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) = 5.6.16-1.el6 for package: mysql-community-client-5.6.16-1.el6.x86_64
---> Package mysql-community-common.x86_64 0:5.6.16-1.el6 will be installed
---> Package perl.x86_64 4:5.10.1-136.el6 will be installed
--> Processing Dependency: perl-libs = 4:5.10.1-136.el6 for package: 4:perl-5.10.1-136.el6.x86_64
--> Processing Dependency: perl-libs for package: 4:perl-5.10.1-136.el6.x86_64
--> Processing Dependency: perl(version) for package: 4:perl-5.10.1-136.el6.x86_64
--> Processing Dependency: perl(Pod::Simple) for package: 4:perl-5.10.1-136.el6.x86_64
--> Processing Dependency: perl(Module::Pluggable) for package: 4:perl-5.10.1-136.el6.x86_64
--> Processing Dependency: libperl.so()(64bit) for package: 4:perl-5.10.1-136.el6.x86_64
---> Package perl-DBI.x86_64 0:1.609-4.el6 will be installed
--> Running transaction check
---> Package mysql-community-libs.x86_64 0:5.6.16-1.el6 will be obsoleting
---> Package mysql-libs.x86_64 0:5.1.71-1.el6 will be obsoleted
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
---> Package perl-Module-Pluggable.x86_64 1:3.90-136.el6 will be installed
---> Package perl-Pod-Simple.x86_64 1:3.13-136.el6 will be installed
--> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.13-136.el6.x86_64
---> Package perl-libs.x86_64 4:5.10.1-136.el6 will be installed
---> Package perl-version.x86_64 3:0.77-136.el6 will be installed
--> Running transaction check
---> Package mysql-libs.x86_64 0:5.1.71-1.el6 will be updated
---> Package mysql-libs.x86_64 0:5.1.73-3.el6_5 will be an update
---> Package perl-Pod-Escapes.x86_64 1:1.04-136.el6 will be installed
---> Package postfix.x86_64 2:2.6.6-2.2.el6_1 will be updated
---> Package postfix.x86_64 2:2.6.6-6.el6_5 will be an update
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package mysql-libs.x86_64 0:5.1.73-3.el6_5 will be an update
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: 2:postfix-2.6.6-6.el6_5.x86_64
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: 2:postfix-2.6.6-6.el6_5.x86_64
--> Running transaction check
---> Package mysql-community-libs-compat.x86_64 0:5.6.16-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                     Arch   Version             Repository         Size
================================================================================
Installing:
 mysql-community-libs        x86_64 5.6.16-1.el6        mysql56-community 1.8 M
     replacing  mysql-libs.x86_64 5.1.71-1.el6
 mysql-community-server      x86_64 5.6.16-1.el6        mysql56-community  52 M
Installing for dependencies:
 mysql-community-client      x86_64 5.6.16-1.el6        mysql56-community  18 M
 mysql-community-common      x86_64 5.6.16-1.el6        mysql56-community 297 k
 mysql-community-libs-compat x86_64 5.6.16-1.el6        mysql56-community 1.6 M
 perl                        x86_64 4:5.10.1-136.el6    base               10 M
 perl-DBI                    x86_64 1.609-4.el6         base              705 k
 perl-Module-Pluggable       x86_64 1:3.90-136.el6      base               40 k
 perl-Pod-Escapes            x86_64 1:1.04-136.el6      base               32 k
 perl-Pod-Simple             x86_64 1:3.13-136.el6      base              212 k
 perl-libs                   x86_64 4:5.10.1-136.el6    base              578 k
 perl-version                x86_64 3:0.77-136.el6      base               51 k
Updating for dependencies:
 postfix                     x86_64 2:2.6.6-6.el6_5     updates           2.0 M

Transaction Summary
================================================================================
Install      12 Package(s)
Upgrade       1 Package(s)

Total download size: 87 M
Is this ok [y/N]: y
Downloading Packages:
(1/13): mysql-community-client-5.6.16-1.el6.x86_64.rpm   |  18 MB     00:00
(2/13): mysql-community-common-5.6.16-1.el6.x86_64.rpm   | 297 kB     00:00
(3/13): mysql-community-libs-5.6.16-1.el6.x86_64.rpm     | 1.8 MB     00:00
(4/13): mysql-community-libs-compat-5.6.16-1.el6.x86_64. | 1.6 MB     00:00
(5/13): mysql-community-server-5.6.16-1.el6.x86_64.rpm   |  52 MB     00:01
(6/13): perl-5.10.1-136.el6.x86_64.rpm                   |  10 MB     00:00
(7/13): perl-DBI-1.609-4.el6.x86_64.rpm                  | 705 kB     00:00
(8/13): perl-Module-Pluggable-3.90-136.el6.x86_64.rpm    |  40 kB     00:00
(9/13): perl-Pod-Escapes-1.04-136.el6.x86_64.rpm         |  32 kB     00:00
(10/13): perl-Pod-Simple-3.13-136.el6.x86_64.rpm         | 212 kB     00:00
(11/13): perl-libs-5.10.1-136.el6.x86_64.rpm             | 578 kB     00:00
(12/13): perl-version-0.77-136.el6.x86_64.rpm            |  51 kB     00:00
(13/13): postfix-2.6.6-6.el6_5.x86_64.rpm                | 2.0 MB     00:00
--------------------------------------------------------------------------------
Total                                            20 MB/s |  87 MB     00:04
warning: rpmts_HdrFromFdno: V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
 Userid : MySQL Release Engineering <mysql-build@oss.oracle.com>
 Package: mysql-community-release-el6-5.noarch (installed)
 From   : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : mysql-community-common-5.6.16-1.el6.x86_64                  1/15
  Installing : mysql-community-libs-5.6.16-1.el6.x86_64                    2/15
  Installing : 1:perl-Pod-Escapes-1.04-136.el6.x86_64                      3/15
  Installing : 1:perl-Pod-Simple-3.13-136.el6.x86_64                       4/15
  Installing : 4:perl-libs-5.10.1-136.el6.x86_64                           5/15
  Installing : 3:perl-version-0.77-136.el6.x86_64                          6/15
  Installing : 1:perl-Module-Pluggable-3.90-136.el6.x86_64                 7/15
  Installing : 4:perl-5.10.1-136.el6.x86_64                                8/15
  Installing : perl-DBI-1.609-4.el6.x86_64                                 9/15
  Installing : mysql-community-client-5.6.16-1.el6.x86_64                 10/15
  Installing : mysql-community-libs-compat-5.6.16-1.el6.x86_64            11/15
  Updating   : 2:postfix-2.6.6-6.el6_5.x86_64                             12/15
  Installing : mysql-community-server-5.6.16-1.el6.x86_64                 13/15
  Cleanup    : 2:postfix-2.6.6-2.2.el6_1.x86_64                           14/15
  Erasing    : mysql-libs-5.1.71-1.el6.x86_64                             15/15
  Verifying  : 1:perl-Module-Pluggable-3.90-136.el6.x86_64                 1/15
  Verifying  : 1:perl-Pod-Escapes-1.04-136.el6.x86_64                      2/15
  Verifying  : mysql-community-server-5.6.16-1.el6.x86_64                  3/15
  Verifying  : 4:perl-5.10.1-136.el6.x86_64                                4/15
  Verifying  : perl-DBI-1.609-4.el6.x86_64                                 5/15
  Verifying  : 1:perl-Pod-Simple-3.13-136.el6.x86_64                       6/15
  Verifying  : 4:perl-libs-5.10.1-136.el6.x86_64                           7/15
  Verifying  : mysql-community-common-5.6.16-1.el6.x86_64                  8/15
  Verifying  : mysql-community-libs-5.6.16-1.el6.x86_64                    9/15
  Verifying  : mysql-community-libs-compat-5.6.16-1.el6.x86_64            10/15
  Verifying  : 2:postfix-2.6.6-6.el6_5.x86_64                             11/15
  Verifying  : 3:perl-version-0.77-136.el6.x86_64                         12/15
  Verifying  : mysql-community-client-5.6.16-1.el6.x86_64                 13/15
  Verifying  : 2:postfix-2.6.6-2.2.el6_1.x86_64                           14/15
  Verifying  : mysql-libs-5.1.71-1.el6.x86_64                             15/15
  Verifying  : mysql-libs-5.1.71-1.el6.x86_64                             16/15

Installed:
  mysql-community-libs.x86_64 0:5.6.16-1.el6
  mysql-community-server.x86_64 0:5.6.16-1.el6

Dependency Installed:
  mysql-community-client.x86_64 0:5.6.16-1.el6
  mysql-community-common.x86_64 0:5.6.16-1.el6
  mysql-community-libs-compat.x86_64 0:5.6.16-1.el6
  perl.x86_64 4:5.10.1-136.el6
  perl-DBI.x86_64 0:1.609-4.el6
  perl-Module-Pluggable.x86_64 1:3.90-136.el6
  perl-Pod-Escapes.x86_64 1:1.04-136.el6
  perl-Pod-Simple.x86_64 1:3.13-136.el6
  perl-libs.x86_64 4:5.10.1-136.el6
  perl-version.x86_64 3:0.77-136.el6

Dependency Updated:
  postfix.x86_64 2:2.6.6-6.el6_5

Replaced:
  mysql-libs.x86_64 0:5.1.71-1.el6

Complete!

Let's see what RPMs that we have installed.
[root@example ~]# rpm -qa | grep mysql
mysql-community-release-el6-5.noarch
mysql-community-common-5.6.16-1.el6.x86_64
mysql-community-libs-compat-5.6.16-1.el6.x86_64
mysql-community-server-5.6.16-1.el6.x86_64
mysql-community-libs-5.6.16-1.el6.x86_64
mysql-community-client-5.6.16-1.el6.x86_64

Make it run automatically after reboots.
[root@example ~]# chkconfig mysqld on
[root@example ~]# chkconfig --list mysqld
mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off

First time to start mysqld.
[root@example ~]# service mysqld start
Initializing MySQL database:  2014-03-25 04:47:08 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-03-25 04:47:08 1854 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-03-25 04:47:08 1854 [Note] InnoDB: The InnoDB memory heap is disabled
2014-03-25 04:47:08 1854 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-03-25 04:47:08 1854 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-03-25 04:47:08 1854 [Note] InnoDB: Using Linux native AIO
2014-03-25 04:47:08 1854 [Note] InnoDB: Not using CPU crc32 instructions
2014-03-25 04:47:08 1854 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-03-25 04:47:08 1854 [Note] InnoDB: Completed initialization of buffer pool
2014-03-25 04:47:08 1854 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2014-03-25 04:47:08 1854 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2014-03-25 04:47:08 1854 [Note] InnoDB: Database physically writes the file full: wait...
2014-03-25 04:47:08 1854 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2014-03-25 04:47:09 1854 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2014-03-25 04:47:09 1854 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2014-03-25 04:47:09 1854 [Warning] InnoDB: New log files created, LSN=45781
2014-03-25 04:47:09 1854 [Note] InnoDB: Doublewrite buffer not found: creating new
2014-03-25 04:47:09 1854 [Note] InnoDB: Doublewrite buffer created
2014-03-25 04:47:09 1854 [Note] InnoDB: 128 rollback segment(s) are active.
2014-03-25 04:47:09 1854 [Warning] InnoDB: Creating foreign key constraint system tables.
2014-03-25 04:47:09 1854 [Note] InnoDB: Foreign key constraint system tables created
2014-03-25 04:47:09 1854 [Note] InnoDB: Creating tablespace and datafile system tables.
2014-03-25 04:47:09 1854 [Note] InnoDB: Tablespace and datafile system tables created.
2014-03-25 04:47:09 1854 [Note] InnoDB: Waiting for purge to start
2014-03-25 04:47:09 1854 [Note] InnoDB: 5.6.16 started; log sequence number 0
2014-03-25 04:47:10 1854 [Note] Binlog end
2014-03-25 04:47:10 1854 [Note] InnoDB: FTS optimize thread exiting.
2014-03-25 04:47:10 1854 [Note] InnoDB: Starting shutdown...
2014-03-25 04:47:11 1854 [Note] InnoDB: Shutdown completed; log sequence number 1625977


2014-03-25 04:47:11 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-03-25 04:47:11 1877 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-03-25 04:47:11 1877 [Note] InnoDB: The InnoDB memory heap is disabled
2014-03-25 04:47:11 1877 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-03-25 04:47:11 1877 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-03-25 04:47:11 1877 [Note] InnoDB: Using Linux native AIO
2014-03-25 04:47:11 1877 [Note] InnoDB: Not using CPU crc32 instructions
2014-03-25 04:47:11 1877 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-03-25 04:47:11 1877 [Note] InnoDB: Completed initialization of buffer pool
2014-03-25 04:47:11 1877 [Note] InnoDB: Highest supported file format is Barracuda.
2014-03-25 04:47:11 1877 [Note] InnoDB: 128 rollback segment(s) are active.
2014-03-25 04:47:11 1877 [Note] InnoDB: Waiting for purge to start
2014-03-25 04:47:11 1877 [Note] InnoDB: 5.6.16 started; log sequence number 1625977
2014-03-25 04:47:11 1877 [Note] Binlog end
2014-03-25 04:47:11 1877 [Note] InnoDB: FTS optimize thread exiting.
2014-03-25 04:47:11 1877 [Note] InnoDB: Starting shutdown...
2014-03-25 04:47:13 1877 [Note] InnoDB: Shutdown completed; log sequence number 1625987




PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

  /usr/bin/mysqladmin -u root password 'new-password'
  /usr/bin/mysqladmin -u root -h example.com password 'new-password'

Alternatively you can run:

  /usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

Note: new default config file not created.
Please make sure your config file is current

WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server

                                                           [  OK  ]
Starting mysqld:                                           [  OK  ]

If you saw an error MySQL Daemon failed to start. when starting the service, you may refer to this post:
How to Resolve "MySQL Daemon failed to start." on Linux

Further reading -How to Install Newest LAMP on CentOS 7 Minimal (1/3) - MySQL

Leave a Reply

Your email address will not be published.