GNU/Linux >> Linux Esercitazione >  >> Cent OS

Installa MariaDB su CentOS 6.4

MariaDB

MariaDB è il fork sviluppato dalla community di Mysql ed è un'ottima alternativa ad esso. È gratuito e open source ed è sviluppato dagli sviluppatori originali di mysql. MariaDB è molto superiore a MySQL in termini di funzionalità. Controlla il confronto tra mariadb e mysql.

E la cosa migliore è che è un sostituto drop-in di mysql, il che significa che basta installare mariadb al posto di mysql e tutte le tue applicazioni basate su mysql verrebbero eseguite allo stesso modo. Tutti i comandi e i driver funzionano allo stesso modo. Le applicazioni php mysql esistenti funzionerebbero allo stesso modo con le estensioni mysql per php.

1. Aggiungi repository mariadb su CentOS

MariaDB non è disponibile nei repository predefiniti di CentOS, quindi dobbiamo prima aggiungere i repository forniti da MariaDB. MariaDB fornisce repository per distribuzioni tra cui ubuntu, centos, debian, fedora.

Visita il seguente sito
https://downloads.mariadb.org/mariadb/repositories/

È il generatore di repository. Seleziona la tua distribuzione Linux, la versione e l'architettura.
Ti verranno fornite le istruzioni per aggiungere il repository.

5,5 o 10

MariDB è disponibile in 2 serie. Il primo è il 5.5 e l'altro è la nuova serie 10.0. La serie 10.0 ha nuove funzionalità non presenti né in mysql né nelle versioni precedenti di mariadb. Dai un'occhiata alle funzionalità di mariadb 10.
Se non hai bisogno di quelle moderne funzionalità della versione 10.0, potresti voler andare con la serie 5.5. Se stai migrando in modo permanente da mysql, puoi prima importare il tuo database in mariadb 5.5 e poi passare alla versione 10, solo per evitare problemi di compatibilità. In caso di problemi basta entrare nel canale irc #mariadb per ottenere un aiuto gratuito.

Lo stiamo facendo su CentOS 6.4 x64, quindi selezionerei le opzioni di conseguenza. mariadb.org mi fornisce i seguenti dettagli del repository per la mia distribuzione.

Here is your custom MariaDB YUM repository entry for CentOS. Copy and paste it into a file under /etc/yum.repos.d/ (we suggest naming the file MariaDB.repo or something similar). See "Installing MariaDB with yum" for detailed information.
# MariaDB 5.5 CentOS repository list - created 2013-11-09 11:31 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Quindi creiamo un file chiamato /etc/yum.repos.d/mariadb.repo e lo riempiamo con il testo sopra indicato.

2. Installa mariadb con yum

Ora fai una ricerca yum per vedere quei pacchetti nel repository, solo per assicurarti di aver configurato correttamente il repository e per ottenere il nome esatto del pacchetto da utilizzare con il comando di installazione in seguito.

# yum search mariadb
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.atlanticmetro.net
 * extras: centos.mirror.constant.com
 * rpmforge: mirror.us.leaseweb.net
 * updates: mirror.atlanticmetro.net
mariadb                                                                                                                                 | 1.9 kB     00:00
Not using downloaded repomd.xml because it is older than what we have:
  Current   : Wed Nov  6 07:36:52 2013
  Downloaded: Mon Sep 30 00:49:11 2013
==================================================================== N/S Matched: mariadb =====================================================================
MariaDB-cassandra-engine.x86_64 : MariaDB: a very fast and robust SQL database server
MariaDB-client.x86_64 : MariaDB: a very fast and robust SQL database server
MariaDB-common.x86_64 : MariaDB: a very fast and robust SQL database server
MariaDB-compat.x86_64 : MariaDB: a very fast and robust SQL database server
MariaDB-connect-engine.x86_64 : MariaDB: a very fast and robust SQL database server
MariaDB-devel.x86_64 : MariaDB: a very fast and robust SQL database server
MariaDB-server.x86_64 : MariaDB: a very fast and robust SQL database server
MariaDB-shared.x86_64 : MariaDB: a very fast and robust SQL database server
MariaDB-test.x86_64 : MariaDB: a very fast and robust SQL database server
  Name and summary matches only, use "search all" for everything.

Come possiamo vedere, i pacchetti MariaDB necessari sono lì pronti per essere installati. Ora esegui un'installazione yum per completare l'attività.

# yum install MariaDB-server MariaDB-client

Questo dovrebbe completare l'installazione di mariadb.

3. Avvia il server MySQL e connettiti ad esso

Per prima cosa avvia il server mysql usando il comando service. Quindi connettiti ad esso usando il comando mysql.

# service mysql start
Starting MySQL.. SUCCESS!
# mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 1
Server version: 5.5.33a-MariaDB MariaDB Server
Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>

Come si può vedere sopra, il comando mysql ci ha permesso di connetterci come root senza chiedere una password. Questo è il modo in cui mariadb è configurato per impostazione predefinita e non è sicuro per l'ambiente di produzione. Per risolvere questo problema, dobbiamo impostare una password di root e apportare altri miglioramenti alla sicurezza, come mostrato nella sezione successiva.

4. Esegui lo script mysql_secure_installation

Per impostazione predefinita, mariadb si installa senza una password di root e molte altre impostazioni non sicure. Per risolvere tutti questi problemi, esegui lo script mysql_secure_installation e proteggi l'installazione. Fa le seguenti cose

1. Imposta la password di root
2. Rimuovere l'utente anonimo
3. Non consentire l'accesso root remoto
4. Rimuovi il database di test

# mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found
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):
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
New password:
Re-enter new 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
 ... 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, 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
 - 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
 ... 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!
[[email protected] public_html]#

Fatto. Ora abbiamo apportato alcuni miglioramenti di base alla sicurezza per MariaDB.

5. Consenti a MariaDB di avviarsi all'avvio

Usa il comando chkconfig per consentire a mariadb di avviarsi all'avvio.

# chkconfig mysql on

Questo è tutto. MariaDB è ora installato e pronto per l'uso. Potresti voler riavviare il sistema per assicurarti che funzioni come previsto. Verifica lo stato con il comando di servizio

# service mysql status
 SUCCESS! MySQL running (1451)

Cent OS
  1. Installa MariaDB o MySQL su Linux

  2. Installa MySQL Server 5.6 in CentOS

  3. Installa MariaDB 10.0 su CentOS 6

  4. Installa InvoicePlane su CentOS

  5. Come installare MySQL 5.6 su CentOS 6.x

Come installare Apache, PHP 7.3 e MySQL su CentOS 7.6

2 modi per installare MariaDB su CentOS 7

Come installare MySQL 8.0 su CentOS 8 / RHEL 8

Come installare MySQL 8 su CentOS 8

Come installare MariaDB su CentOS 6

Come installare Joomla su CentOS 7