CentOS 7 and MySQL 5.6

Un poco de historia

La última versión de Red Hat Enterprise Linux, una de las distribuciones de Linux más populares y respetadas en el mercado de servidores, se publicó en junio de 2014, seguido por los lanzamientos de CentOS 7 y Oracle Linux en julio del mismo año.

Hay cambios muy interesantes para administradores de bases de datos en estas nuevas versiones, de las cuales me gustaría destacar el hecho de que el instalador oficial ahora selecciona XFS como el sistema de archivos por defecto, sustituyendo a ext4 como el formato preferido para almacenamiento local. Red Hat EL7 también incluye Btrfs como tech preview.

Respecto a paquetería, el cambio con mayor impacto es, en mi opinión, la actualización de las versiones de MySQL y PostgreSQL, en verdad necesitadas de un upgrade, ya que la anterior versión de Red Hat, 6.5, todavía utilizava versiones con 5 años de edad de ambos SGBBDD, los cuales se encontraban fuera de su ciclo de vida de soporte. La mayor sorpresa es que Red Hat ha optado por elegir MariaDB 5.5, y no Oracle, como el proveedor por defecto de MySQL (o compatible). Esto tiene la hilarante consecuencia de que Oracle Linux está distribuyendo en realidad la versión de su competidor, MariaDB a través de sus repositories, con el objetivo de ser 100% compatible. La diferencia, claro está, es que Oracle ofrece la última versión de MySQL en sus repositorios de yum y, por lo tanto, está disponible para su instalación en todas las distribuciones compatibles con Red Hat.

Prerequisitos

En este tutorial os mostraremos cómo instalar MySQL 5.6 en CentOS 7, útil para aquellos que prefieran desplegar la última versión GA de MySQL. 5.6 introduce una gran cantidad de mejoras sobre MySQL 5.5, y dado que Red Hat EL7 tiene un ciclo de soporte de al menos 10 años, es posible que se vuelva muy anticuada en el futuro. Vamos a mostrar el proceso en CentOS 7, pero éste será idéntico en RHEL 7 y, hasta cierto punto, en otras distribuciones basadas en yum como las últimas versiones de Fedora y Amazon Linux.

Por favor, tenga en cuenta que el siguiente tutorial supone que no hay una versión previamente instalada de MySQL o MariaDB. Puede utilizar el siguiente comando: rpm -qa | grep -i mysql para comprobar paquentes de MySQL que estén instalados con anterioridad, y borrarlos con el comando yum remove.

Tutorial

El primer paso es configurar el repositori de MySQL de Oracle; para ello, nos dirigimos a la web de mysql.com, pulse en “Downloads“, luego en “Yum repository” y finalmente en “Red Hat Enterprise Linux 7”. En el momento de escribir estas líneas, está versión del respositorio se encuentra todavía en beta, pero no tuve problemas para instalarlo en diversas conbinaciones de software y hardware. Seleccione “Download” y le aparecerá la opción de acceder o crear una cuenta de Oracle. Podemos omitir este paso y simplemente copiar el enlace en la parte inferior que dice “No thanks , just start my download”. Esto nos proporcionará la dirección del rpm para auto-configurar los repositorios de la versión Community del servidor de MySQL.

Ahora, si ejecuta en un terminal:

$ sudo yum install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
[sudo] password for training:
Loaded plugins: fastestmirror
mysql-community-release-el7-5.noarch.rpm                                                               | 6.0 kB  00:00:00    
Examining /var/tmp/yum-root-uI5SBL/mysql-community-release-el7-5.noarch.rpm: mysql-community-release-el7-5.noarch
Marking /var/tmp/yum-root-uI5SBL/mysql-community-release-el7-5.noarch.rpm to be installed

Resolving Dependencies

--> Running transaction check
---> Package mysql-community-release.noarch 0:el7-5 will be installed
--> Finished Dependency Resolution

Dependencies Resolved
==============================================================================================================================
Package                            Arch              Version          Repository                                        Size
==============================================================================================================================
Installing:
mysql-community-release            noarch            el7-5            /mysql-community-release-el7-5.noarch            4.3 k

Transaction Summary
==============================================================================================================================
Install  1 Package

Total size: 4.3 k
Installed size: 4.3 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
 Installing : mysql-community-release-el7-5.noarch                                                                       1/1
 Verifying  : mysql-community-release-el7-5.noarch                                                                       1/1

Installed:
 mysql-community-release.noarch 0:el7-5                                                                                      

Complete!

Podemos comprobar que los respositories están efectivamente activos ejecutando:

$ sudo yum repolist enabled | grep "mysql.*-community.*"
[sudo] password for training:
mysql-connectors-community/x86_64       MySQL Connectors Community            9
mysql-tools-community/x86_64            MySQL Tools Community                 4
mysql56-community/x86_64                MySQL 5.6 Community Server           49

Acabamos de realizar la configuración (sólo es necesario hacerlo una vez) que nos permitirá instalar y mantener actualizada nuestra instalación de MySQL de manera fácil y sencilla.

El siguiente paso es instalar realmente los paquetes del servidor. Para ello, escribimos:

$ sudo yum install mysql-community-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirror.xtratelecom.es
 * extras: centos.mirror.xtratelecom.es
 * updates: centos.mirror.xtratelecom.es
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.6.19-2.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.6.19-2.el7 for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) = 5.6.19-2.el7 for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: perl(warnings) for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: perl(strict) for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: perl(if) for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: perl(Sys::Hostname) for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: perl(POSIX) for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: perl(Getopt::Long) for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: perl(File::Temp) for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: perl(File::Spec) for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: perl(File::Path) for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: perl(File::Copy) for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: perl(File::Basename) for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: perl(Fcntl) for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: perl(Data::Dumper) for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: perl(DBI) for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: net-tools for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: /usr/bin/perl for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Processing Dependency: libaio.so.1()(64bit) for package: mysql-community-server-5.6.19-2.el7.x86_64
--> Running transaction check
---> Package libaio.x86_64 0:0.3.109-12.el7 will be installed
---> Package mysql-community-client.x86_64 0:5.6.19-2.el7 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) = 5.6.19-2.el7 for package: mysql-community-client-5.6.19-2.el7.x86_64
--> Processing Dependency: perl(Exporter) for package: mysql-community-client-5.6.19-2.el7.x86_64
---> Package mysql-community-common.x86_64 0:5.6.19-2.el7 will be installed
---> Package net-tools.x86_64 0:2.0-0.17.20131004git.el7 will be installed
---> Package perl.x86_64 4:5.16.3-283.el7 will be installed
--> Processing Dependency: perl-libs = 4:5.16.3-283.el7 for package: 4:perl-5.16.3-283.el7.x86_64
--> Processing Dependency: perl(Socket) >= 1.3 for package: 4:perl-5.16.3-283.el7.x86_64
--> Processing Dependency: perl(Scalar::Util) >= 1.10 for package: 4:perl-5.16.3-283.el7.x86_64
--> Processing Dependency: perl-macros for package: 4:perl-5.16.3-283.el7.x86_64
--> Processing Dependency: perl-libs for package: 4:perl-5.16.3-283.el7.x86_64
--> Processing Dependency: perl(threads::shared) for package: 4:perl-5.16.3-283.el7.x86_64
--> Processing Dependency: perl(threads) for package: 4:perl-5.16.3-283.el7.x86_64
--> Processing Dependency: perl(constant) for package: 4:perl-5.16.3-283.el7.x86_64
--> Processing Dependency: perl(Time::Local) for package: 4:perl-5.16.3-283.el7.x86_64
--> Processing Dependency: perl(Storable) for package: 4:perl-5.16.3-283.el7.x86_64
--> Processing Dependency: perl(Socket) for package: 4:perl-5.16.3-283.el7.x86_64
--> Processing Dependency: perl(Scalar::Util) for package: 4:perl-5.16.3-283.el7.x86_64
--> Processing Dependency: perl(Pod::Simple::XHTML) for package: 4:perl-5.16.3-283.el7.x86_64
--> Processing Dependency: perl(Pod::Simple::Search) for package: 4:perl-5.16.3-283.el7.x86_64
--> Processing Dependency: perl(Filter::Util::Call) for package: 4:perl-5.16.3-283.el7.x86_64
--> Processing Dependency: perl(Carp) for package: 4:perl-5.16.3-283.el7.x86_64
--> Processing Dependency: libperl.so()(64bit) for package: 4:perl-5.16.3-283.el7.x86_64
---> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed
--> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64
--> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64
---> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed
---> Package perl-File-Path.noarch 0:2.09-2.el7 will be installed
---> Package perl-File-Temp.noarch 0:0.23.01-3.el7 will be installed
---> Package perl-Getopt-Long.noarch 0:2.40-2.el7 will be installed
--> Processing Dependency: perl(Pod::Usage) >= 1.14 for package: perl-Getopt-Long-2.40-2.el7.noarch
--> Processing Dependency: perl(Text::ParseWords) for package: perl-Getopt-Long-2.40-2.el7.noarch
---> Package perl-PathTools.x86_64 0:3.40-5.el7 will be installed
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.37-1.el7_0 will be obsoleted
---> Package mysql-community-libs.x86_64 0:5.6.19-2.el7 will be obsoleting
---> Package perl-Carp.noarch 0:1.26-244.el7 will be installed
---> Package perl-Exporter.noarch 0:5.68-3.el7 will be installed
---> Package perl-Filter.x86_64 0:1.49-3.el7 will be installed
---> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed
--> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.el7.noarch
---> Package perl-Pod-Simple.noarch 1:3.28-4.el7 will be installed
--> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
--> Processing Dependency: perl(Encode) for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
---> Package perl-Pod-Usage.noarch 0:1.63-3.el7 will be installed
--> Processing Dependency: perl(Pod::Text) >= 3.15 for package: perl-Pod-Usage-1.63-3.el7.noarch
--> Processing Dependency: perl-Pod-Perldoc for package: perl-Pod-Usage-1.63-3.el7.noarch
---> Package perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 will be installed
---> Package perl-Socket.x86_64 0:2.010-3.el7 will be installed
---> Package perl-Storable.x86_64 0:2.45-3.el7 will be installed
---> Package perl-Text-ParseWords.noarch 0:3.29-4.el7 will be installed
---> Package perl-Time-Local.noarch 0:1.2300-2.el7 will be installed
---> Package perl-constant.noarch 0:1.27-2.el7 will be installed
---> Package perl-libs.x86_64 4:5.16.3-283.el7 will be installed
---> Package perl-macros.x86_64 4:5.16.3-283.el7 will be installed
---> Package perl-threads.x86_64 0:1.87-4.el7 will be installed
---> Package perl-threads-shared.x86_64 0:1.43-6.el7 will be installed
--> Running transaction check
---> Package perl-Encode.x86_64 0:2.51-7.el7 will be installed
---> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be installed
--> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
--> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
---> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed
---> Package perl-Pod-Escapes.noarch 1:1.04-283.el7 will be installed
---> Package perl-Pod-Perldoc.noarch 0:3.20-4.el7 will be installed
--> Processing Dependency: perl(parent) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
--> Processing Dependency: perl(HTTP::Tiny) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
---> Package perl-podlators.noarch 0:2.5.1-3.el7 will be installed
--> Running transaction check
---> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed
---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed
---> Package perl-HTTP-Tiny.noarch 0:0.033-3.el7 will be installed
---> Package perl-parent.noarch 1:0.225-244.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================
 Package                            Arch              Version                              Repository                    Size
==============================================================================================================================
Installing:
 mysql-community-libs               x86_64            5.6.19-2.el7                         mysql56-community            2.0 M
     replacing  mariadb-libs.x86_64 1:5.5.37-1.el7_0
 mysql-community-server             x86_64            5.6.19-2.el7                         mysql56-community             57 M
Installing for dependencies:
 libaio                             x86_64            0.3.109-12.el7                       base                          24 k
 mysql-community-client             x86_64            5.6.19-2.el7                         mysql56-community             19 M
 mysql-community-common             x86_64            5.6.19-2.el7                         mysql56-community            247 k
 net-tools                          x86_64            2.0-0.17.20131004git.el7             base                         304 k
 perl                               x86_64            4:5.16.3-283.el7                     base                         8.0 M
 perl-Carp                          noarch            1.26-244.el7                         base                          19 k
 perl-Compress-Raw-Bzip2            x86_64            2.061-3.el7                          base                          32 k
 perl-Compress-Raw-Zlib             x86_64            1:2.061-4.el7                        base                          57 k
 perl-DBI                           x86_64            1.627-4.el7                          base                         802 k
 perl-Data-Dumper                   x86_64            2.145-3.el7                          base                          47 k
 perl-Encode                        x86_64            2.51-7.el7                           base                         1.5 M
 perl-Exporter                      noarch            5.68-3.el7                           base                          28 k
 perl-File-Path                     noarch            2.09-2.el7                           base                          26 k
 perl-File-Temp                     noarch            0.23.01-3.el7                        base                          56 k
 perl-Filter                        x86_64            1.49-3.el7                           base                          76 k
 perl-Getopt-Long                   noarch            2.40-2.el7                           base                          56 k
 perl-HTTP-Tiny                     noarch            0.033-3.el7                          base                          38 k
 perl-IO-Compress                   noarch            2.061-2.el7                          base                         260 k
 perl-Net-Daemon                    noarch            0.48-5.el7                           base                          51 k
 perl-PathTools                     x86_64            3.40-5.el7                           base                          82 k
 perl-PlRPC                         noarch            0.2020-14.el7                        base                          36 k
 perl-Pod-Escapes                   noarch            1:1.04-283.el7                       base                          49 k
 perl-Pod-Perldoc                   noarch            3.20-4.el7                           base                          87 k
 perl-Pod-Simple                    noarch            1:3.28-4.el7                         base                         216 k
 perl-Pod-Usage                     noarch            1.63-3.el7                           base                          27 k
 perl-Scalar-List-Utils             x86_64            1.27-248.el7                         base                          36 k
 perl-Socket                        x86_64            2.010-3.el7                          base                          49 k
 perl-Storable                      x86_64            2.45-3.el7                           base                          77 k
 perl-Text-ParseWords               noarch            3.29-4.el7                           base                          14 k
 perl-Time-Local                    noarch            1.2300-2.el7                         base                          24 k
 perl-constant                      noarch            1.27-2.el7                           base                          19 k
 perl-libs                          x86_64            4:5.16.3-283.el7                     base                         686 k
 perl-macros                        x86_64            4:5.16.3-283.el7                     base                          42 k
 perl-parent                        noarch            1:0.225-244.el7                      base                          12 k
 perl-podlators                     noarch            2.5.1-3.el7                          base                         112 k
 perl-threads                       x86_64            1.87-4.el7                           base                          49 k
 perl-threads-shared                x86_64            1.43-6.el7                           base                          39 k

Transaction Summary
==============================================================================================================================
Install  2 Packages (+37 Dependent packages)

Total download size: 91 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/mysql56-community/packages/mysql-community-common-5.6.19-2.el7.x86_64.rpm: V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Public key for mysql-community-common-5.6.19-2.el7.x86_64.rpm is not installed
(1/39): mysql-community-common-5.6.19-2.el7.x86_64.rpm                                                 | 247 kB  00:00:01     
(2/39): libaio-0.3.109-12.el7.x86_64.rpm                                                               |  24 kB  00:00:03     
(3/39): mysql-community-libs-5.6.19-2.el7.x86_64.rpm                                                   | 2.0 MB  00:00:05     
(4/39): perl-Carp-1.26-244.el7.noarch.rpm                                                              |  19 kB  00:00:02     
(5/39): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm                                                 |  32 kB  00:00:01     
(6/39): net-tools-2.0-0.17.20131004git.el7.x86_64.rpm                                                  | 304 kB  00:00:04     
(7/39): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm                                                  |  57 kB  00:00:01     
(8/39): perl-Data-Dumper-2.145-3.el7.x86_64.rpm                                                        |  47 kB  00:00:01     
(9/39): perl-DBI-1.627-4.el7.x86_64.rpm                                                                | 802 kB  00:00:03     
(10/39): perl-Exporter-5.68-3.el7.noarch.rpm                                                           |  28 kB  00:00:00     
(11/39): perl-File-Path-2.09-2.el7.noarch.rpm                                                          |  26 kB  00:00:00     
(12/39): perl-File-Temp-0.23.01-3.el7.noarch.rpm                                                       |  56 kB  00:00:00     
(13/39): perl-Filter-1.49-3.el7.x86_64.rpm                                                             |  76 kB  00:00:00     
(14/39): perl-Getopt-Long-2.40-2.el7.noarch.rpm                                                        |  56 kB  00:00:00     
(15/39): perl-HTTP-Tiny-0.033-3.el7.noarch.rpm                                                         |  38 kB  00:00:00     
(16/39): perl-IO-Compress-2.061-2.el7.noarch.rpm                                                       | 260 kB  00:00:01     
(17/39): perl-Encode-2.51-7.el7.x86_64.rpm                                                             | 1.5 MB  00:00:08     
(18/39): perl-Net-Daemon-0.48-5.el7.noarch.rpm                                                         |  51 kB  00:00:03     
(19/39): perl-PlRPC-0.2020-14.el7.noarch.rpm                                                           |  36 kB  00:00:00     
(20/39): perl-Pod-Escapes-1.04-283.el7.noarch.rpm                                                      |  49 kB  00:00:00     
(21/39): perl-Pod-Perldoc-3.20-4.el7.noarch.rpm                                                        |  87 kB  00:00:01     
(22/39): perl-Pod-Simple-3.28-4.el7.noarch.rpm                                                         | 216 kB  00:00:02     
(23/39): perl-Pod-Usage-1.63-3.el7.noarch.rpm                                                          |  27 kB  00:00:00     
(24/39): perl-Scalar-List-Utils-1.27-248.el7.x86_64.rpm                                                |  36 kB  00:00:00     
(25/39): perl-Socket-2.010-3.el7.x86_64.rpm                                                            |  49 kB  00:00:00     
(26/39): perl-Storable-2.45-3.el7.x86_64.rpm                                                           |  77 kB  00:00:00     
(27/39): perl-Text-ParseWords-3.29-4.el7.noarch.rpm                                                    |  14 kB  00:00:00     
(28/39): perl-Time-Local-1.2300-2.el7.noarch.rpm                                                       |  24 kB  00:00:00     
(29/39): perl-constant-1.27-2.el7.noarch.rpm                                                           |  19 kB  00:00:00     
(30/39): perl-PathTools-3.40-5.el7.x86_64.rpm                                                          |  82 kB  00:00:12     
(31/39): perl-libs-5.16.3-283.el7.x86_64.rpm                                                           | 686 kB  00:00:03     
(32/39): perl-parent-0.225-244.el7.noarch.rpm                                                          |  12 kB  00:00:00     
(33/39): perl-podlators-2.5.1-3.el7.noarch.rpm                                                         | 112 kB  00:00:00     
(34/39): perl-threads-1.87-4.el7.x86_64.rpm                                                            |  49 kB  00:00:00     
(35/39): perl-threads-shared-1.43-6.el7.x86_64.rpm                                                     |  39 kB  00:00:00     
(36/39): perl-macros-5.16.3-283.el7.x86_64.rpm                                                         |  42 kB  00:00:05     
(37/39): mysql-community-client-5.6.19-2.el7.x86_64.rpm                                                |  19 MB  00:00:57     
(38/39): perl-5.16.3-283.el7.x86_64.rpm                                                                | 8.0 MB  00:01:13     
(39/39): mysql-community-server-5.6.19-2.el7.x86_64.rpm                                                |  57 MB  00:01:35     
------------------------------------------------------------------------------------------------------------------------------
Total                                                                                         915 kB/s |  91 MB  00:01:41     
Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
 Userid     : "MySQL Release Engineering "
 Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
 Package    : mysql-community-release-el7-5.noarch (@/mysql-community-release-el7-5.noarch)
 From       : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mysql-community-common-5.6.19-2.el7.x86_64                                                                1/40 
  Installing : mysql-community-libs-5.6.19-2.el7.x86_64                                                                  2/40 
  Installing : 1:perl-parent-0.225-244.el7.noarch                                                                        3/40 
  Installing : perl-HTTP-Tiny-0.033-3.el7.noarch                                                                         4/40 
  Installing : perl-podlators-2.5.1-3.el7.noarch                                                                         5/40 
  Installing : perl-Pod-Perldoc-3.20-4.el7.noarch                                                                        6/40 
  Installing : 1:perl-Pod-Escapes-1.04-283.el7.noarch                                                                    7/40 
  Installing : perl-Text-ParseWords-3.29-4.el7.noarch                                                                    8/40 
  Installing : perl-Encode-2.51-7.el7.x86_64                                                                             9/40 
  Installing : perl-Pod-Usage-1.63-3.el7.noarch                                                                         10/40 
  Installing : 4:perl-libs-5.16.3-283.el7.x86_64                                                                        11/40 
  Installing : 4:perl-macros-5.16.3-283.el7.x86_64                                                                      12/40 
  Installing : perl-Storable-2.45-3.el7.x86_64                                                                          13/40 
  Installing : perl-Exporter-5.68-3.el7.noarch                                                                          14/40 
  Installing : perl-constant-1.27-2.el7.noarch                                                                          15/40 
  Installing : perl-Time-Local-1.2300-2.el7.noarch                                                                      16/40 
  Installing : perl-Socket-2.010-3.el7.x86_64                                                                           17/40 
  Installing : perl-Carp-1.26-244.el7.noarch                                                                            18/40 
  Installing : perl-PathTools-3.40-5.el7.x86_64                                                                         19/40 
  Installing : perl-Scalar-List-Utils-1.27-248.el7.x86_64                                                               20/40 
  Installing : perl-File-Temp-0.23.01-3.el7.noarch                                                                      21/40 
  Installing : perl-File-Path-2.09-2.el7.noarch                                                                         22/40 
  Installing : perl-threads-shared-1.43-6.el7.x86_64                                                                    23/40 
  Installing : perl-threads-1.87-4.el7.x86_64                                                                           24/40 
  Installing : perl-Filter-1.49-3.el7.x86_64                                                                            25/40 
  Installing : 1:perl-Pod-Simple-3.28-4.el7.noarch                                                                      26/40 
  Installing : perl-Getopt-Long-2.40-2.el7.noarch                                                                       27/40 
  Installing : 4:perl-5.16.3-283.el7.x86_64                                                                             28/40 
  Installing : perl-Data-Dumper-2.145-3.el7.x86_64                                                                      29/40 
  Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                                                               30/40 
  Installing : perl-Net-Daemon-0.48-5.el7.noarch                                                                        31/40 
  Installing : mysql-community-client-5.6.19-2.el7.x86_64                                                               32/40 
  Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                                                              33/40 
  Installing : perl-IO-Compress-2.061-2.el7.noarch                                                                      34/40 
  Installing : perl-PlRPC-0.2020-14.el7.noarch                                                                          35/40 
  Installing : perl-DBI-1.627-4.el7.x86_64                                                                              36/40 
  Installing : libaio-0.3.109-12.el7.x86_64                                                                             37/40 
  Installing : net-tools-2.0-0.17.20131004git.el7.x86_64                                                                38/40 
  Installing : mysql-community-server-5.6.19-2.el7.x86_64                                                               39/40 
  Erasing    : 1:mariadb-libs-5.5.37-1.el7_0.x86_64                                                                     40/40 
  Verifying  : perl-HTTP-Tiny-0.033-3.el7.noarch                                                                         1/40 
  Verifying  : perl-threads-shared-1.43-6.el7.x86_64                                                                     2/40 
  Verifying  : perl-Storable-2.45-3.el7.x86_64                                                                           3/40 
  Verifying  : net-tools-2.0-0.17.20131004git.el7.x86_64                                                                 4/40 
  Verifying  : perl-Exporter-5.68-3.el7.noarch                                                                           5/40 
  Verifying  : perl-constant-1.27-2.el7.noarch                                                                           6/40 
  Verifying  : perl-PathTools-3.40-5.el7.x86_64                                                                          7/40 
  Verifying  : 4:perl-5.16.3-283.el7.x86_64                                                                              8/40 
  Verifying  : libaio-0.3.109-12.el7.x86_64                                                                              9/40 
  Verifying  : mysql-community-server-5.6.19-2.el7.x86_64                                                               10/40 
  Verifying  : 1:perl-parent-0.225-244.el7.noarch                                                                       11/40 
  Verifying  : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                                                               12/40 
  Verifying  : perl-Net-Daemon-0.48-5.el7.noarch                                                                        13/40 
  Verifying  : 1:perl-Pod-Simple-3.28-4.el7.noarch                                                                      14/40 
  Verifying  : perl-File-Temp-0.23.01-3.el7.noarch                                                                      15/40 
  Verifying  : 4:perl-libs-5.16.3-283.el7.x86_64                                                                        16/40 
  Verifying  : perl-Time-Local-1.2300-2.el7.noarch                                                                      17/40 
  Verifying  : mysql-community-libs-5.6.19-2.el7.x86_64                                                                 18/40 
  Verifying  : perl-Pod-Perldoc-3.20-4.el7.noarch                                                                       19/40 
  Verifying  : perl-DBI-1.627-4.el7.x86_64                                                                              20/40 
  Verifying  : perl-Socket-2.010-3.el7.x86_64                                                                           21/40 
  Verifying  : 4:perl-macros-5.16.3-283.el7.x86_64                                                                      22/40 
  Verifying  : mysql-community-client-5.6.19-2.el7.x86_64                                                               23/40 
  Verifying  : perl-Carp-1.26-244.el7.noarch                                                                            24/40 
  Verifying  : perl-Data-Dumper-2.145-3.el7.x86_64                                                                      25/40 
  Verifying  : perl-Scalar-List-Utils-1.27-248.el7.x86_64                                                               26/40 
  Verifying  : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                                                              27/40 
  Verifying  : perl-IO-Compress-2.061-2.el7.noarch                                                                      28/40 
  Verifying  : perl-Pod-Usage-1.63-3.el7.noarch                                                                         29/40 
  Verifying  : perl-PlRPC-0.2020-14.el7.noarch                                                                          30/40 
  Verifying  : perl-Encode-2.51-7.el7.x86_64                                                                            31/40 
  Verifying  : perl-podlators-2.5.1-3.el7.noarch                                                                        32/40 
  Verifying  : perl-Getopt-Long-2.40-2.el7.noarch                                                                       33/40 
  Verifying  : perl-File-Path-2.09-2.el7.noarch                                                                         34/40 
  Verifying  : perl-threads-1.87-4.el7.x86_64                                                                           35/40 
  Verifying  : perl-Filter-1.49-3.el7.x86_64                                                                            36/40 
  Verifying  : 1:perl-Pod-Escapes-1.04-283.el7.noarch                                                                   37/40 
  Verifying  : perl-Text-ParseWords-3.29-4.el7.noarch                                                                   38/40 
  Verifying  : mysql-community-common-5.6.19-2.el7.x86_64                                                               39/40 
  Verifying  : 1:mariadb-libs-5.5.37-1.el7_0.x86_64                                                                     40/40 

Installed:
  mysql-community-libs.x86_64 0:5.6.19-2.el7                   mysql-community-server.x86_64 0:5.6.19-2.el7                  

Dependency Installed:
  libaio.x86_64 0:0.3.109-12.el7                                mysql-community-client.x86_64 0:5.6.19-2.el7                 
  mysql-community-common.x86_64 0:5.6.19-2.el7                  net-tools.x86_64 0:2.0-0.17.20131004git.el7                  
  perl.x86_64 4:5.16.3-283.el7                                  perl-Carp.noarch 0:1.26-244.el7                              
  perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7                  perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7                  
  perl-DBI.x86_64 0:1.627-4.el7                                 perl-Data-Dumper.x86_64 0:2.145-3.el7                        
  perl-Encode.x86_64 0:2.51-7.el7                               perl-Exporter.noarch 0:5.68-3.el7                            
  perl-File-Path.noarch 0:2.09-2.el7                            perl-File-Temp.noarch 0:0.23.01-3.el7                        
  perl-Filter.x86_64 0:1.49-3.el7                               perl-Getopt-Long.noarch 0:2.40-2.el7                         
  perl-HTTP-Tiny.noarch 0:0.033-3.el7                           perl-IO-Compress.noarch 0:2.061-2.el7                        
  perl-Net-Daemon.noarch 0:0.48-5.el7                           perl-PathTools.x86_64 0:3.40-5.el7                           
  perl-PlRPC.noarch 0:0.2020-14.el7                             perl-Pod-Escapes.noarch 1:1.04-283.el7                       
  perl-Pod-Perldoc.noarch 0:3.20-4.el7                          perl-Pod-Simple.noarch 1:3.28-4.el7                          
  perl-Pod-Usage.noarch 0:1.63-3.el7                            perl-Scalar-List-Utils.x86_64 0:1.27-248.el7                 
  perl-Socket.x86_64 0:2.010-3.el7                              perl-Storable.x86_64 0:2.45-3.el7                            
  perl-Text-ParseWords.noarch 0:3.29-4.el7                      perl-Time-Local.noarch 0:1.2300-2.el7                        
  perl-constant.noarch 0:1.27-2.el7                             perl-libs.x86_64 4:5.16.3-283.el7                            
  perl-macros.x86_64 4:5.16.3-283.el7                           perl-parent.noarch 1:0.225-244.el7                           
  perl-podlators.noarch 0:2.5.1-3.el7                           perl-threads.x86_64 0:1.87-4.el7                             
  perl-threads-shared.x86_64 0:1.43-6.el7                      

Replaced:
  mariadb-libs.x86_64 1:5.5.37-1.el7_0                                                                                        

Complete!

Como podrá apreciar, los paquetes del servidor Community hacen referencia a la última versión de MySQL 5.6. Durante el proceso de instalación, sólo dos interrupciones se producirán (aparte de la petición de contraseña de sudo), una para la confirmación de los cambios, y otra para la importación de la clave de releases de los ingenieros de Oracle en su sistema, que podremos aceptar sin problemas si su fingerprint conincide con el siguiente: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5. Recuerde que, en el caso de procesos automatizados, podemos añadir la opción -y (decir sí a todo) a yum, pero quería mostrar el proceso completo, así como realizar el proceso con buenas prácticas de seguridad.

La instalación ya se ha completado, ahora sólo tenemos que ejecutarlo y probarlo. Recuerde que Red Hat Enterprise Linux 7 reemplaza la gestión de servicios por systemd, por lo que la manera “correcta” de iniciar el servicio de mysql es:

$ sudo systemctl start mysqld

Puede comprobar que ha iniciado correctamente haciendo:

$ sudo systemctl status mysqld
mysqld.service - MySQL Community Server
  Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled)
  Active: active (running) since Sun 2014-07-27 11:20:40 EDT; 10s ago
 Process: 10660 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS)
 Process: 10599 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 10659 (mysqld_safe)
  CGroup: /system.slice/mysqld.service
          ├─10659 /bin/sh /usr/bin/mysqld_safe
          └─10801 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-erro...

Jul 27 11:20:39 localhost.localdomain mysql-systemd-start[10599]: Support MySQL by buying support/licenses at http://sho...com
Jul 27 11:20:39 localhost.localdomain mysql-systemd-start[10599]: Note: new default config file not created.
Jul 27 11:20:39 localhost.localdomain mysql-systemd-start[10599]: Please make sure your config file is current
Jul 27 11:20:39 localhost.localdomain mysql-systemd-start[10599]: WARNING: Default config file /etc/my.cnf exists on the...tem
Jul 27 11:20:39 localhost.localdomain mysql-systemd-start[10599]: This file will be read by default by the MySQL server
Jul 27 11:20:39 localhost.localdomain mysql-systemd-start[10599]: If you do not want to use this, either remove it, or use the
Jul 27 11:20:39 localhost.localdomain mysql-systemd-start[10599]: --defaults-file argument to mysqld_safe when starting ...ver
Jul 27 11:20:39 localhost.localdomain mysqld_safe[10659]: 140727 11:20:39 mysqld_safe Logging to '/var/log/mysqld.log'.
Jul 27 11:20:39 localhost.localdomain mysqld_safe[10659]: 140727 11:20:39 mysqld_safe Starting mysqld daemon with datab...ysql
Jul 27 11:20:40 localhost.localdomain systemd[1]: Started MySQL Community Server.
Hint: Some lines were ellipsized, use -l to show in full.

Y conectarse desde localhost haciendo:

$ mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.19 MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

Recuerda también activar el autoinicio en el arranque, ya que es algo que querrás en la mayoría de los casos (esto también ha cambiado comparado con CentOS 6):

$ sudo systemctl enable mysqld.service
ln -s '/usr/lib/systemd/system/mysqls.service' '/etc/systemd/system/mysql.service'
ln -s '/usr/lib/systemd/system/mysqls.service' '/etc/systemd/system/multi-user.target.wants/mysqld.service'

Puede comprobar que se ha activado correctamente con el comando ‘status’ mostrado anteriormente; debería mostrarse ahora como “enabled” (activado).

Como buen administrador, los siguientes pasos son configurar las cuentas de usuario y securizar el servicio de mysql, pero eso está fuera de los objetivos de este tutorial.

Gracias a la instalación mediante respositorios, sus paquetes ahora pueden ser actualizados fácilmente tan sólo usando yum.

Para una documentación más detallada, puede revisar la documentación oficial. Los ingenieros de Oracle publicaron también una interestante historia sobr el proceso de pruebas de sus paquetes.

Espero que este tutorial haya sido de utilidad.

Cómo instalar MySQL 5.6 en CentOS 7
Etiquetado en:                                                                                

4 thoughts on “Cómo instalar MySQL 5.6 en CentOS 7

  • 2014-11-01 a las 16:12
    Enlace permanente

    Hola

    Intente seguir tu tutorial pero cuando ejecuto ” sudo systemctl start mysqld”

    obtengo el error:

    Job for mysqld.service failed. See ‘systemctl status mysqld.service’ and ‘journalctl -xn’ for details.

    y al revisar systemctl status mysqld.service me manda lo siguiente

    mysqld.service – MySQL Community Server

    Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled)

    Active: failed (Result: start-limit) since Sat 2014-11-01 08:47:45 CST; 12s ago

    Process: 4158 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=1/FAILURE)

    Nov 01 08:47:45 npss-backup-dev systemd[1]: mysqld.service: control process exited, code=exited status=1

    Nov 01 08:47:45 npss-backup-dev systemd[1]: Failed to start MySQL Community Server.

    Nov 01 08:47:45 npss-backup-dev systemd[1]: Unit mysqld.service entered failed state.

    Nov 01 08:47:45 npss-backup-dev systemd[1]: mysqld.service holdoff time over, scheduling restart.

    Nov 01 08:47:45 npss-backup-dev systemd[1]: Stopping MySQL Community Server…

    Nov 01 08:47:45 npss-backup-dev systemd[1]: Starting MySQL Community Server…

    Nov 01 08:47:45 npss-backup-dev systemd[1]: mysqld.service start request repeated too quickly, refusing to start.

    Nov 01 08:47:45 npss-backup-dev systemd[1]: Failed to start MySQL Community Server.

    Nov 01 08:47:45 npss-backup-dev systemd[1]: Unit mysqld.service entered failed state.

    Que crees que pueda estar mal?

    estoy en Centos 7

    • 2014-11-06 a las 09:09
      Enlace permanente

      Parece que simplemente te falló el inicio de MySQL. Cosas que pueden hacer fallar MySQL: permisos de sistema de archivos o de selinux, falta de espacio en disco o una configuración errónea.

      Echa un vistazo al log de mysql (normalmente, en /var/log/mysql/) o inicia directamente mysqld_safe para comprobar qué fue lo que falló. Si no cambiaste la configuración ni recuperaste datos, selinux suele ser un buen candidato, especialmente con paquetes de terceros.

  • 2014-12-16 a las 16:26
    Enlace permanente

    Muy buen tutorial me ayudo bastante, muchas gracias.

  • 2015-03-19 a las 05:47
    Enlace permanente

    Muchas gracias, me salvo la vida!!!!… toda la noche buscado como hacer correr MySql en CentOS 7

Los comentarios están cerrados.