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的默認版本,配置數據庫服務器
1
2
3
4
5
6
7
8
|
[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 mariadb ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service' |
初始化mariadb
連接mariadb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
[root@linuxprobe ~] # mysql -u root -p enter password: welcome to the mariadb monitor. commands end with ; or \g. your mariadb connection id is 1023 server version: 5.5.50-mariadb mariadb server copyright (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端口
1
2
3
4
5
|
# 客戶端設置 [root@vdevops ~] # firewall-cmd --add-service=mysql --permanent success [root@vdevops ~] # firewall-cmd --reload success |
安裝phpmyadmin
前提安裝web服務器和php,參考下面:
http://www.ythuaji.com.cn/article/207898.html
http://www.ythuaji.com.cn/article/207912.html
安裝phpmyadmin
1
2
3
4
5
6
7
8
|
# 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 access require ip 127.0.0.1 10.1.1.0 /24 # line 34: ip address you permit to access require 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.ythuaji.com.cn/article/80637.html
安裝 mariadb 10.1
配置 centos sclo源倉庫
來自centos-sclo-rh的軟件包安裝在/ opt目錄下。 要使用它,加載環境變量如下。
1
2
3
4
5
|
[root@linuxprobe ~] # scl enable rh-mariadb101 bash [root@linuxprobe ~] # mysql -v mysql 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,請如下配置
1
2
3
4
5
|
[root@linuxprobe ~] # vi /etc/profile.d/rh-mariadb101.sh # create new #!/bin/bash source /opt/rh/rh-mariadb101/enable export x_scls= "`scl enable rh-mariadb101 'echo $x_scls'`" |
啟用mariadb 10.1并配置初始設置
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持服務器之家。
原文鏈接:http://blog.csdn.net/wh211212/article/details/53129488