Bazo podatkov MariaDB namestite v RHEL/CentOS/Fedora in Debian/Ubuntu


MariaDB je binarna zamenjava za MySQL, ki so jo razvili izvirni avtorji MySQL Project in je popolnoma združljiv z MySQL z več funkcijami in boljšo zmogljivostjo. Dokler nismo napisali te objave, je MariaDB 10.0 Series razvojna različica (Alpha), MariaDB 5.5 pa trenutna stabilna izdaja (GA)

Zakaj naj uporabljam MariaDB?

Kot vsi vemo, se MySQL pogosto uporablja in je najbolj priljubljen RDBMS in prva izbira razvijalcev. Leta 2008 je družbo Sun Microsystem prevzel MySQL, ki ga je pozneje kupil Oracle in ni več odprtokodna.

No, MariaDB sponzorira Monty Program AB & MariaDB Foundation, neodvisen razvijalec pa je MySQL in drugi člani skupnosti ter je resnično odprtokoden. Človek, ki je ustvaril bazo podatkov MySQL s strani Michael “Monty” Widenius, David Axmark in Allan Larsso, ustanovitelj MySQL in Monty Program AB, zdaj stoji za MariaDB. Nadzirali bi razvoj fundacije MariaDB.

Kdo uporablja MariaDB?

Obstaja veliko distribucij in velika spletna mesta so prešla na MariaDB, nekatere med njimi so:

  1. Mozilla Corporation
  2. Wikipedija
  3. OpenSuse
  4. Fedora
  5. OLX
  6. Nimbuzz
  7. SlashGear
  8. ArchLinux
  9. Redhat Enterprise Linux (iz RHEL7)
  10. Slackware
  11. Mageia
  12. Slackware
  13. TurboLinux
  14. Projekt Čakra
  15. Gentoo
  16. GNU/Linux KDu

Namestitev zbirke podatkov MariaDB v RHEL/CentOS 6/5 in Fedora 18/17

Za namestitev toplo priporočamo uporabo shrambe MariaDB YUM (Package Manager) po meri. Ustvarite repo datoteko v /etc/yum.repos.d/MariaDB.repo, kopirajte in prilepite naslednje vnose pod njo.

Trenutno so na voljo repozitoriji MariaDB za RHEL 6, RHEL5, CentOS 6, CentOS 5 in Fedora 20,19,18,17. Prosimo, izberite in dodajte pravilno shrambo v različico vašega OS.

# MariaDB 5.5 RedHat repository list - created 2013-08-11 14:29 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/rhel6-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
# MariaDB 5.5 RedHat repository list - created 2013-08-11 14:30 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/rhel6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
# MariaDB 5.5 RedHat repository list - created 2013-08-11 14:31 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/rhel5-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
# MariaDB 5.5 RedHat repository list - created 2013-08-11 14:31 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/rhel5-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
# MariaDB 5.5 CentOS repository list - created 2013-08-11 14:21 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos6-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
# MariaDB 5.5 CentOS repository list - created 2013-08-11 14:22 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
# MariaDB 5.5 CentOS repository list - created 2013-08-11 14:23 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos5-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
# MariaDB 5.5 CentOS repository list - created 2013-08-11 14:23 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos5-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
# MariaDB 5.5 Fedora repository list - created 2014-03-19 06:34 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/fedora20-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
# MariaDB 5.5 Fedora repository list - created 2014-03-19 06:35 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/fedora20-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
# MariaDB 5.5 Fedora repository list - created 2014-03-19 06:31 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/fedora19-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
# MariaDB 5.5 Fedora repository list - created 2014-03-19 06:34 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/fedora19-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
# MariaDB 5.5 Fedora repository list - created 2013-08-11 14:32 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/fedora18-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
# MariaDB 5.5 Fedora repository list - created 2013-08-11 14:33 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/fedora18-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
# MariaDB 5.5 Fedora repository list - created 2013-08-11 14:33 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/fedora17-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
# MariaDB 5.5 Fedora repository list - created 2013-08-11 14:33 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/fedora17-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Ko datoteko MariaDB.repo postavite pod /etc/yum.repos.d/. Namestimo z naslednjim ukazom YUM.

# On RHEL/CentOS 6/5 and Fedora 19,18,17 #
 yum -y install MariaDB MariaDB-server

# On Fedora 20 #
 yum -y install mariadb mariadb-server

Če ključ MariaDB GPG Signing ni nameščen, ga bo YUM samodejno namestil po prenosu vseh paketov.

Po končani namestitvi zaženite MariaDB z naslednjim ukazom.

# On RHEL/CentOS 6/5 and Fedora 19,18,17 #
 /etc/init.d/mysql start

# On Fedora 20 #
 systemctl start mariadb.service 
 systemctl enable mariadb.service

V terminal vnesite ukaz 'mysql'. Privzeto geslo za root je prazno.

 mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 1
Server version: 5.5.32-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)]>

Zaženite naslednji ukaz za ogled privzetih zbirk podatkov, ki so priložene namestitvi.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

V ukazni poziv vnesite quit za izhod iz lupine.

MariaDB [(none)]> quit
Bye

Po namestitvi natančno preberite in pod vsakim korakom nastavite root geslo , odstranite anonimne uporabnike , onemogočite oddaljeno prijavo root in odstranite testno bazo podatkov in dostop za zaščito MariaDB.

  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!

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!

Ko je skript za namestitev končan, morate znova zagnati bazo podatkov MariaDB, da sprejmete nove spremembe.

# On RHEL/CentOS 6/5 and Fedora 19,18,17 #
 /etc/init.d/mysql restart

# On Fedora 20 #
 systemctl restart mariadb.service 

Nastavite MariaDB za zagon ob zagonu

 chkconfig mysql on

Poskusimo se povezati z novo nastavljeno korensko poverilnico in videli bi nekaj podobnega.

 mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 1
Server version: 5.5.32-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)]>

Namestitev zbirke podatkov MariaDB v Debian 7/6 in Ubuntu 13.04/12/10/12.04

Za namestitev toplo priporočamo uporabo skladišča po meri. Zaženite naslednje ukaze, da v svoj sistem dodate MariaDB. Upoštevajte, da bo ključ za podpisovanje pri uvozu isti ostal enak v Debianu in Ubuntuju.

[email :~$ sudo apt-get install python-software-properties
[email :~$ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db

Kopirajte in prilepite naslednje vnose v datoteko /etc/apt/sources.list na dnu.

# MariaDB 5.5 repository list - created 2013-08-11 15:03 UTC
# http://mariadb.org/mariadb/repositories/
deb http://mirrors.scie.in/mariadb/repo/5.5/debian wheezy main
deb-src http://mirrors.scie.in/mariadb/repo/5.5/debian wheezy main
# MariaDB 5.5 repository list - created 2013-08-11 15:17 UTC
# http://mariadb.org/mariadb/repositories/
deb http://mirrors.scie.in/mariadb/repo/5.5/debian squeeze main
deb-src http://mirrors.scie.in/mariadb/repo/5.5/debian squeeze main
# MariaDB 5.5 repository list - created 2014-03-19 06:47 UTC
# http://mariadb.org/mariadb/repositories/
deb http://mirrors.scie.in/mariadb/repo/5.5/ubuntu saucy main
deb-src http://mirrors.scie.in/mariadb/repo/5.5/ubuntu saucy main
# MariaDB 5.5 repository list - created 2013-08-11 15:18 UTC
# http://mariadb.org/mariadb/repositories/
deb http://mirrors.scie.in/mariadb/repo/5.5/ubuntu raring main
deb-src http://mirrors.scie.in/mariadb/repo/5.5/ubuntu raring main
# MariaDB 5.5 repository list - created 2013-08-11 15:24 UTC
# http://mariadb.org/mariadb/repositories/
deb http://mirrors.scie.in/mariadb/repo/5.5/ubuntu quantal main
deb-src http://mirrors.scie.in/mariadb/repo/5.5/ubuntu quantal main
# MariaDB 5.5 repository list - created 2013-08-11 15:24 UTC
# http://mariadb.org/mariadb/repositories/
deb http://mirrors.scie.in/mariadb/repo/5.5/ubuntu precise main
deb-src http://mirrors.scie.in/mariadb/repo/5.5/ubuntu precise main

Ko pravilno uvozite ključ in pravilno dodate repozitorij, lahko namestite MariaDB z ukazom apt-get, kot je prikazano. Med namestitvijo boste morda zahtevali nastavitev korenskega gesla za bazo podatkov.

[email :~$ sudo apt-get update
[email :~$ sudo apt-get install mariadb-server

Prijavite se MariaDB s korensko poverilnico, ki je bila nastavljena prej.

[email :~$ sudo mysql -u root -p
[sudo] password for narad: 
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 42
Server version: 10.0.3-MariaDB-1~raring-log mariadb.org binary distribution

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)]>
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

Opomba: V ukazni poziv vnesite quit za izhod iz baze podatkov.

Referenčne povezave

  1. MariaDB proti MySQL - funkcije
  2. MariaDB dokumentacija
  3. Domača stran MariaDB