MariaDB簡介
MariaDB資料庫管理系統是MySQL的一個分支,主要由開源社區在維護,採用GPL授權許可 MariaDB的目的是完全相容MySQL,包括API和命令列,使之能輕鬆成為MySQL的代替品。在儲存引擎方面,使用XtraDB(英語:XtraDB)來代替MySQL的InnoDB。 MariaDB由MySQL的創始人Michael Widenius(英語:Michael Widenius)主導開發,他早前曾以10億美元的價格,將自己建立的公司MySQL AB賣給了SUN,此後,隨著SUN被甲骨文收購,MySQL的所有權也落入Oracle的手中。MariaDB名稱來自Michael Widenius的女兒Maria的名字。
MariaDB 官網:https://mariadb.org/
MariaDB 下載:https://downloads.mariadb.org/
MariaDB Github地址:https://github.com/MariaDB/server
安裝MariaDB 5.5
安裝MariaDB 5.5是CentOS 7的預設版本,設定資料庫伺服器
[root@linuxprobe~]# yum -y install mariadb-server[root@linuxprobe~]# vi /etc/my.cnf# add follows within [mysqld] section[mysqld]character-set-server=utf8[root@linuxprobe~]# systemctl start mariadb[root@linuxprobe~]# systemctl enable mariadbln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service'
初始化MariaDB
複製代碼 代碼如下:
[root@linuxprobe~]# mysql_secure_installation #和MySQL一樣,一路y
串連MariaDB
[root@linuxprobe ~]# mysql -u root -pEnter password: Welcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 1023Server version: 5.5.50-MariaDB MariaDB ServerCopyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> select user,host,password from mysql.user;+-----------+-----------+-------------------------------------------+| user | host | password |+-----------+-----------+-------------------------------------------+| root | localhost | *F1DAE8BCDFCA7A57F246E0F834AC35830A3D640E || root | 127.0.0.1 | *F1DAE8BCDFCA7A57F246E0F834AC35830A3D640E || root | ::1 | *F1DAE8BCDFCA7A57F246E0F834AC35830A3D640E |+-----------+-----------+-------------------------------------------+5 rows in set (0.00 sec)MariaDB [(none)]> show databases;+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema |+--------------------+5 rows in set (0.05 sec)MariaDB [(none)]> exit;Bye
防火牆開啟3306連接埠
# 用戶端設定[root@vdevops ~]# firewall-cmd --add-service=mysql --permanentsuccess[root@vdevops ~]# firewall-cmd --reloadsuccess
安裝phpMyAdmin
前提安裝web伺服器和php,參考下面:
http://www.jb51.net/article/97434.htm
http://www.jb51.net/article/97587.htm
安裝phpMyAdmin
# install from EPEL[root@linuxprobe~]# yum --enablerepo=epel -y install phpMyAdmin php-mysql php-mcrypt[root@linuxprobe~]# vi /etc/httpd/conf.d/phpMyAdmin.conf# line 17: IP address you permit to accessRequire ip 127.0.0.1 10.1.1.0/24# line 34: IP address you permit to accessRequire ip 127.0.0.1 10.1.1.o/24[root@linuxprobe ~]# systemctl restart httpd
使用Web瀏覽器從用戶端訪問“http://(您的主機名稱或IP地址)/ phpmyadmin /',然後在MariaDB的使用者在以下螢幕上登入。此樣本使用root使用者繼續。
登入之後,您可以在這裡操作MariaDB
MariaDB 主從複製
MariaDB 主從複製和MySQL主從複製相同,請移步到:http://www.jb51.net/article/97412.htm
安裝 MariaDB 10.1
配置 CentOS SCLo源倉庫
複製代碼 代碼如下:
[root@linuxprobe ~]# yum --enablerepo=centos-sclo-rh -y install rh-mariadb101-mariadb-server
來自centos-sclo-rh的軟體包安裝在/ opt目錄下。 要使用它,載入環境變數如下。
[root@linuxprobe ~]# scl enable rh-mariadb101 bash [root@linuxprobe ~]# mysql -Vmysql Ver 15.1 Distrib 10.1.14-MariaDB, for Linux (x86_64) using EditLine wrapper[root@linuxprobe ~]# which mysql/opt/rh/rh-mariadb101/root/usr/bin/mysql
如果您希望在登入時自動啟用MariaDB 10.1,請如下配置
[root@linuxprobe ~]# vi /etc/profile.d/rh-mariadb101.sh# create new#!/bin/bashsource /opt/rh/rh-mariadb101/enableexport X_SCLS="`scl enable rh-mariadb101 'echo $X_SCLS'`"
啟用MariaDB 10.1並配置初始設定
複製代碼 代碼如下:
[root@linuxprobe ~]# mysql_secure_installation
以上就是本文的全部內容,希望對大家的學習有所協助,也希望大家多多支援雲棲社區。