GNU/Linux >> Tutoriels Linux >  >> Cent OS

Comment installer MariaDB sur CentOS 6 / RHEL 6

MariaDB est le système de gestion de base de données open source le plus populaire. Il est utilisé par les petites et grandes entreprises pour stocker des données.

MariaDB est un fork du célèbre serveur de base de données MySQL, développé par MariaDB Corporation Ab, dirigé par les développeurs originaux de MySQL. Il est entièrement compatible avec la base de données MySQL pour assurer une capacité de remplacement instantané et utilisé comme serveur de base de données dans la pile LAMP et LEMP.

Dans cet article, nous verrons comment installer MariaDB sur CentOS 6 / RHEL 6.

Installer MariaDB sur CentOS 6 / RHEL 6

Ajouter un référentiel MariaDB

La fondation MariaDB propose des packages MariaDB pour CentOS 6 / RHEL 6. Les packages fournis par la communauté MariaDB sont toujours les plus récents et sont pris en charge par eux.

Ajoutez le référentiel MariaDB au système.

CentOS 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

Installez le serveur MariaDB à l'aide de la commande suivante.

yum install -y MariaDB-server MariaDB-client

Gérer le service MariaDB

Démarrez le service MariaDB (mysql) avec la commande suivante.

service mysql start

Vérifiez si le service MariaDB est en cours d'exécution ou non.

service mysql status

Configurez le serveur MariaDB pour qu'il démarre automatiquement au démarrage du système.

chkconfig mysql on

Installation sécurisée de MariaDB

Exécutez la commande mysql_secure_installation pour effectuer la configuration initiale du serveur MariaDB.

Il est recommandé d'effectuer cette configuration initiale sur les serveurs Linux de production pour supprimer les utilisateurs anonymes, tester la base de données et interdire la connexion root à distance.

mysql_secure_installation

Sortie :

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!

Accéder à MariaDB

Connectez-vous au serveur MariaDB.

mysql -u root -p

Sortie :

Conclusion

C'est tout. J'espère que vous avez compris comment installer MariaDB sur CentOS 6 / RHEL 6. Lisez les articles MariaDB pour débutants pour en savoir plus sur l'utilisation de MariaDB.


Cent OS
  1. Comment installer MariaDB sur CentOS 7

  2. Comment installer TeamViewer sur CentOS 6 / RHEL 6

  3. Comment installer Nextcloud sur CentOS 8 / RHEL 8

  4. Comment installer MariaDB sur CentOS 7 / RHEL 7

  5. Comment installer MariaDB 10.4 sur CentOS 8 et RHEL 8

Comment installer OpenLiteSpeed, PHP 7.0 et MariaDB sur CentOS 7 / RHEL 7

Comment installer MariaDB sur CentOS 8 / RHEL 8

Comment installer MariaDB sur CentOS 6 / RHEL 6

Comment installer Zabbix Server 5.0 / 4.0 sur CentOS 8 / RHEL 8

Comment installer MariaDB sur CentOS 6

Comment installer MariaDB sur CentOS 7