MySQL : Instalando Percona Server 5.6 en RHEL 6.5

MySQL : Instalando Percona Server 5.6 en RHEL 6.5

Eitale ! Estoy aquí de vuelta con una nueva aventura en mi carrera, y debido a esto voy a estar investigando un poco más al mundo de MySQL.

Para arrancar, me puse la tarea de instalar Percona Server 5.6, que es una variante de MySQL que trata de mantener toda la compatibilidad de Oracle MySQL, pero al mismo tiempo proporcionar un mejor rendimiento, o eso es lo que me han dicho 🙂

Así que después de hacer una instalación del OS Red Hat Enterprise Linux 6.5, la primera cosa que hice fue configurar el repositorio de YUM para poder instalar Percona Server.

root@localhost ~]# yum install http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm
Loaded plugins: refresh-packagekit, security
Setting up Install Process
percona-release-0.0-1.x86_64.rpm | 6.1 kB 00:00
Examining /var/tmp/yum-root-3c6w0E/percona-release-0.0-1.x86_64.rpm: percona-release-0.0-1.x86_64
Marking /var/tmp/yum-root-3c6w0E/percona-release-0.0-1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package percona-release.x86_64 0:0.0-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================
Installing:
percona-release x86_64 0.0-1 /percona-release-0.0-1.x86_64 3.6 k

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

Total size: 3.6 k
Installed size: 3.6 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : percona-release-0.0-1.x86_64 1/1
Verifying : percona-release-0.0-1.x86_64 1/1

Installed:
percona-release.x86_64 0:0.0-1

Complete!

La próxima cosa que hice, fue tratar de hacer la instalación, como estaba marcado en la pagina de instalación de Percona, pero para mi sorpresa, no pude ,ya que me tope con los siguientes errores marcados en rojo

[root@localhost ~]# yum install Percona-Server-client-56 Percona-Server-server-56
Loaded plugins: refresh-packagekit, security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package Percona-Server-client-56.x86_64 0:5.6.20-rel68.0.el6 will be installed
...
--> Finished Dependency Resolution
Error: mysql conflicts with Percona-Server-client-56-5.6.20-rel68.0.el6.x86_64
Error: mysql-server conflicts with Percona-Server-server-56-5.6.20-rel68.0.el6.x86_64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest

Después de investigar un poco, me di cuenta de que mi problema era que ya tenía algunas bibliotecas de MySQL instaladas, así que lo que debía de hacer era desintalarlas; También ya que este fue mi primer intento, no sé si esta fue la forma correcta de hacerlo o no, o si es que se puede hacer en un servidor de producción, por lo que debes de hacerlo con cuidado:

[root@localhost ~]# yum remove mysql-libs
Loaded plugins: refresh-packagekit, security
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-libs.x86_64 0:5.1.71-1.el6 will be erased
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: mysql-server-5.1.71-1.el6.x86_64
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: 2:postfix-2.6.6-2.2.el6_1.x86_64
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: redland-1.0.7-11.el6.x86_64
...
---> Package crontabs.noarch 0:1.10-33.el6 will be erased
---> Package sysstat.x86_64 0:9.0.4-22.el6 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================
Removing:
mysql-libs x86_64 5.1.71-1.el6 @anaconda-OracleLinuxServer-201311252058.x86_64/6.5 4.0 M
Removing for dependencies:
akonadi x86_64 1.2.1-2.el6 @anaconda-OracleLinuxServer-201311252058.x86_64/6.5 1.7 M
...

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

Dependency Removed:
akonadi.x86_64 0:1.2.1-2.el6 cronie.x86_64 0:1.4.4-12.el6 cronie-anacron.x86_64 0:1.4.4-12.el6
crontabs.noarch 0:1.10-33.el6 kcoloredit.x86_64 0:4.3.3-2.el6 kdeaccessibility.x86_64 1:4.3.4-5.el6
kdeaccessibility-libs.x86_64 1:4.3.4-5.el6 kdeadmin.x86_64 7:4.3.4-5.0.1.el6 kdeartwork-screensavers.x86_64 0:4.3.4-7.el6
kdebase.x86_64 6:4.3.4-6.0.1.el6 kdebase-libs.x86_64 6:4.3.4-6.0.1.el6 kdebase-runtime.x86_64 0:4.3.4-9.el6
kdebase-runtime-libs.x86_64 0:4.3.4-9.el6 kdebase-workspace.x86_64 0:4.3.4-24.0.1.el6 kdebase-workspace-libs.x86_64 0:4.3.4-24.0.1.el6
kdegames.x86_64 6:4.3.4-5.el6 kdegames-libs.x86_64 6:4.3.4-5.el6 kdegraphics.x86_64 7:4.3.4-6.el6
kdegraphics-libs.x86_64 7:4.3.4-6.el6 kdelibs.x86_64 6:4.3.4-20.el6_4.1 kdelibs-experimental.x86_64 0:4.3.4-3.el6
kdemultimedia.x86_64 6:4.3.4-3.el6 kdemultimedia-libs.x86_64 6:4.3.4-3.el6 kdenetwork.x86_64 7:4.3.4-11.el6_0.1
kdenetwork-libs.x86_64 7:4.3.4-11.el6_0.1 kdepim.x86_64 6:4.3.4-6.el6 kdepim-libs.x86_64 6:4.3.4-6.el6
kdepim-runtime.x86_64 0:4.3.4-5.el6 kdepim-runtime-libs.x86_64 0:4.3.4-5.el6 kdepimlibs.x86_64 0:4.3.4-4.el6
kdepimlibs-akonadi.x86_64 0:4.3.4-4.el6 kdeplasma-addons.x86_64 0:4.3.4-5.el6 kdeplasma-addons-libs.x86_64 0:4.3.4-5.el6
kdeutils.x86_64 6:4.3.4-7.el6 kdeutils-libs.x86_64 6:4.3.4-7.el6 kdm.x86_64 0:4.3.4-24.0.1.el6
kiconedit.x86_64 0:4.3.3-1.el6 kio_sysinfo.x86_64 0:20090930-1.el6 kipi-plugins.x86_64 0:0.8.0-5.el6
kipi-plugins-libs.x86_64 0:0.8.0-5.el6 kmid.x86_64 0:2.0-0.14.20080213svn.el6 konq-plugins.x86_64 0:4.3.3-5.el6
ksig.x86_64 0:1.1-0.10.20080213.el6 ksshaskpass.x86_64 0:0.5.1-4.1.el6 libcgroup.x86_64 0:0.40.rc1-5.el6
mysql.x86_64 0:5.1.71-1.el6 mysql-server.x86_64 0:5.1.71-1.el6 numad.x86_64 0:0.5-9.20130814git.el6
perl-DBD-MySQL.x86_64 0:4.013-3.el6 postfix.x86_64 2:2.6.6-2.2.el6_1 qt-mysql.x86_64 1:4.6.2-26.el6_4
redhat-lsb.x86_64 0:4.0-7.0.1.el6 redhat-lsb-compat.x86_64 0:4.0-7.0.1.el6 redhat-lsb-core.x86_64 0:4.0-7.0.1.el6
redhat-lsb-graphics.x86_64 0:4.0-7.0.1.el6 redhat-lsb-printing.x86_64 0:4.0-7.0.1.el6 redland.x86_64 0:1.0.7-11.el6
soprano.x86_64 0:2.3.1-1.2.el6 sysstat.x86_64 0:9.0.4-22.el6

Complete!

Ahora, lo que hice, sólo para estar seguro de no haber dañado lo que ya tenia instalado y de lo que había quitado, es hacer una actualización

[root@localhost ~]# yum update

Después de esto, ya estaba listo para hacer la instalación del Percona Server sin ningún problema

[root@localhost ~]# yum install Percona-Server-client-56 Percona-Server-server-56
Loaded plugins: refresh-packagekit, security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package Percona-Server-client-56.x86_64 0:5.6.20-rel68.0.el6 will be installed
...
===========================================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================================
Installing:
Percona-Server-client-56 x86_64 5.6.20-rel68.0.el6 percona 6.4 M
Percona-Server-server-56 x86_64 5.6.20-rel68.0.el6 percona 19 M
Installing for dependencies:
Percona-Server-shared-56 x86_64 5.6.20-rel68.0.el6 percona 720 k
...
Installed:
Percona-Server-client-56.x86_64 0:5.6.20-rel68.0.el6 Percona-Server-server-56.x86_64 0:5.6.20-rel68.0.el6

Dependency Installed:
Percona-Server-shared-56.x86_64 0:5.6.20-rel68.0.el6

Complete!

Lo que intenté hacer a continuación era iniciar una sesión, pero me enfrente a otro error

[root@localhost ~]# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Así que ahora, y esto yo no lo sabía, es que el servicio tenia que ser iniciado, lo cual fue bastante simple

[root@localhost ~]# service mysql start
Starting MySQL (Percona Server). SUCCESS!

Sólo para estar del lado seguro, aseguré el ambiente como se recomienda

[root@localhost ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
... Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
... Success!

By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] n
... skipping.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
... Success!

All done! If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

Cleaning up...

Para terminar este ejercicio, cree un usuario administrador, y en el siguiente paso, traté de verificar que era capaz de iniciar una sesión

[oracle@localhost Desktop]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 12
Server version: 5.6.20-68.0 Percona Server (GPL), Release 68.0, Revision 656

Copyright (c) 2009-2014 Percona LLC and/or its affiliates
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> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE USER 'rene'@'%' IDENTIFIED BY 'oracle';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on *.* to 'rene'@'%' with grant option;
Query OK, 0 rows affected (0.01 sec)

mysql>; FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> exit

Como puedes ver a continuación, tuve éxito en este ejercicio 🙂

[oracle@localhost Desktop]$ mysql -u rene -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 13
Server version: 5.6.20-68.0 Percona Server (GPL), Release 68.0, Revision 656

Copyright (c) 2009-2014 Percona LLC and/or its affiliates
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> SELECT user, host FROM mysql.user;
+------+-----------+
| user | host |
+------+-----------+
| rene | % |
| root | 127.0.0.1 |
| root | ::1 |
| root | localhost |
+------+-----------+
4 rows in set (0.00 sec)

mysql> SELECT USER(), CURRENT_USER();
+----------------+----------------+
| USER() | CURRENT_USER() |
+----------------+----------------+
| rene@localhost | rene@% |
+----------------+----------------+
1 row in set (0.00 sec)

mysql> SHOW VARIABLES LIKE 'skip_networking';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| skip_networking | OFF |
+-----------------+-------+
1 row in set (0.01 sec)

mysql>

Conclusión

Esto fue sólo un pequeño ejercicio de mi instalación de Percona, aunque esto no significa que sea la correcta,  si te puede ayudar en identificar los problemas a los que me enfrente cuando estaba tratando de instalar el servidor, espero que esto te sirva cuando vayas a hacer tu primera instalación.

Tags:
,
Rene Antunez
[email protected]
No Comments

Sorry, the comment form is closed at this time.