GNU/Linux >> Tutoriales Linux >  >> Cent OS

Cómo instalar MariaDB en CentOS 6 / RHEL 6

MariaDB es el sistema de gestión de bases de datos de código abierto más popular. Es utilizado por pequeñas y grandes empresas para almacenar datos.

MariaDB es una bifurcación del famoso servidor de base de datos MySQL, desarrollado por MariaDB Corporation Ab, dirigido por los desarrolladores originales de MySQL. Es totalmente compatible con la base de datos MySQL para garantizar una capacidad de reemplazo directa y se utiliza como servidor de base de datos en la pila LAMP y LEMP.

En esta publicación, veremos cómo instalar MariaDB en CentOS 6 / RHEL 6.

Instalar MariaDB en CentOS 6/RHEL 6

Agregar repositorio de MariaDB

La fundación MariaDB ofrece paquetes MariaDB para CentOS 6 / RHEL 6. Los paquetes proporcionados por la comunidad MariaDB son siempre los más recientes y cuentan con el respaldo de ellos.

Agregue el repositorio de MariaDB al sistema.

Cent OS 6

### CentOS 6 64 Bit ###

cat <<EOF >> /etc/yum.repos.d/mariadb.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

### CentOS 6 32 Bit ###

cat <<EOF >> /etc/yum.repos.d/mariadb.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos6-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

RHEL 6

### RHEL 6 64 Bit ###

cat <<EOF >> /etc/yum.repos.d/mariadb.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/rhel6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

### RHEL 6 32 Bit ###

cat <<EOF >> /etc/yum.repos.d/mariadb.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/rhel6-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

Instale el servidor MariaDB usando el siguiente comando.

yum install -y MariaDB-server MariaDB-client

Administrar el servicio MariaDB

Inicie el servicio MariaDB (mysql) con el siguiente comando.

service mysql start

Verifique si el servicio MariaDB se está ejecutando o no.

service mysql status

Configure el servidor MariaDB para que se inicie automáticamente al iniciar el sistema.

chkconfig mysql on

Instalación segura de MariaDB

Ejecute el comando mysql_secure_installation para realizar la configuración inicial del servidor MariaDB.

Se recomienda realizar esta configuración inicial en servidores Linux de producción para eliminar usuarios anónimos, probar la base de datos y no permitir el inicio de sesión raíz remoto.

mysql_secure_installation

Salida:

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

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, 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):  << No root password. Just press Enter
OK, successfully used password, moving on...

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

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


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB 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  << Remove anonymous users
 ... 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  << Disallow root login remotely
 ... Success!

By default, MariaDB 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] Y  << Remove test database
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

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

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

Cleaning up...

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

Thanks for using MariaDB!

Acceder a MariaDB

Inicie sesión en el servidor MariaDB.

mysql -u root -p

Salida:

Conclusión

Eso es todo. Espero que haya entendido cómo instalar MariaDB en CentOS 6/RHEL 6. Lea los artículos para principiantes de MariaDB para obtener más información sobre cómo trabajar con MariaDB.


Cent OS
  1. Cómo instalar MariaDB en CentOS 7

  2. Cómo instalar TeamViewer en CentOS 6 / RHEL 6

  3. Cómo instalar Nextcloud en CentOS 8 / RHEL 8

  4. Cómo instalar MariaDB en CentOS 7 / RHEL 7

  5. Cómo instalar MariaDB 10.4 en CentOS 8 y RHEL 8

Cómo instalar OpenLiteSpeed, PHP 7.0 y MariaDB en CentOS 7 / RHEL 7

Cómo instalar MariaDB en CentOS 8 / RHEL 8

Cómo instalar MariaDB en CentOS 6 / RHEL 6

Cómo instalar el servidor Zabbix 5.0/4.0 en CentOS 8/RHEL 8

Cómo instalar MariaDB en CentOS 6

Cómo instalar MariaDB en CentOS 7