目錄
- 系列教程
- 一、yum包管理器安裝MariaDB-server
- 二、官方二進制包方式安裝MariaDB-server
- 三、源碼編譯安裝MariaDB-server
系列教程
MySQL系列之開篇 MySQL關系型數據庫基礎概念
MySQL系列之二 多實例配置
MySQL系列之三 基礎篇
MySQL系列之四 SQL語法
MySQL系列之五 視圖、存儲函數、存儲過程、觸發器
MySQL系列之六 用戶與授權
MySQL系列之七 MySQL存儲引擎
MySQL系列之八 MySQL服務器變量
MySQL系列之九 mysql查詢緩存及索引
MySQL系列之十 MySQL事務隔離實現并發控制
MySQL系列之十一 日志記錄
MySQL系列之十二 備份與恢復
MySQL系列之十三 MySQL的復制
MySQL系列之十四 MySQL的高可用實現
MySQL系列之十五 MySQL常用配置和性能壓力測試
一、yum包管理器安裝MariaDB-server
1)配置yum源(MariaDB官方源)
[root@centos6 ~]# vim /etc/yum.repos.d/mariadb-10.2.repo
[mariadb]
name=MariaDB
baseurl=http://yum.mariadb.org/10.2/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
2)安裝
[root@centos6 ~]# yum -y install MariaDB-server
3)啟動服務并測試
[root@centos6 ~]# service mysql start
[root@centos6 mysql]# mysql #連接成功則說明OK!
二、官方二進制包方式安裝MariaDB-server
1)獲取二進制包
# wget http://sfo1.mirrors.digitalocean.com/mariadb//mariadb-10.2.15/bintar-linux-x86_64/mariadb-10.2.15-linux-x86_64.tar.gz
2)創建組和用戶
[root@centos6 ~]# groupadd -r -g 27 mysql
[root@centos6 ~]# useradd -r -u 27 -g 27 -m -d /data/mysqldb -s /sbin/nologin mysql
3)解壓軟件包并修改權限
[root@centos6 ~]# tar xf mariadb-10.2.15-linux-x86_64.tar.gz -C /usr/local/
[root@centos6 ~]# cd /usr/local/
[root@centos6 local]# ln -s mariadb-10.2.15-linux-x86_64/ mysql
[root@centos6 local]# chown -R root:root mysql/
[root@centos6 local]# setfacl -R -m u:mysql:rwx mysql/
4)設置環境變量
[root@centos6 local]# echo "export PATH=/usr/local/mysql/bin:\$PATH" >/etc/profile.d/mysql.sh
[root@centos6 local]# . /etc/profile.d/mysql.sh
5)初始化數據庫
[root@centos6 local]# cd /usr/local/mysql/ #必須要進入此目錄來執行初始化腳本
[root@centos6 mysql]# scripts/mysql_install_db --datadir=/data/mysqldb/ --user=mysql
6)提供配置文件
[root@centos6 mysql]# cp support-files/my-huge.cnf /etc/my.cnf
[root@centos6 mysql]# sed -i.bak '/\[mysqld\]/adatadir = /data/mysqldb' /etc/my.cnf
7)提供啟動服務腳本
[root@centos6 mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[root@centos6 mysql]# chkconfig --add mysqld
[root@centos6 mysql]# chkconfig mysqld on
8)啟動并測試
[root@centos6 mysql]# service mysqld start
[root@centos6 mysql]# mysql #連接成功則說明OK!
三、源碼編譯安裝MariaDB-server
1)獲取源碼
# wget http://ftp.hosteurope.de/mirror/archive.mariadb.org//mariadb-10.2.15/source/mariadb-10.2.15.tar.gz
2)準備基礎環境
[root@centos6 ~]# yum -y install bison bison-devel zlib-devel libcurl-devel libarchive-devel boost-devel gcc gcc-c++ cmake libevent-devel gnutls-devel libaio-devel openssl-devel ncurses-devel libxml2-devel
3)創建組和用戶
[root@centos6 ~]# groupadd -r -g 27 mysql
[root@centos6 ~]# useradd -r -u 27 -g 27 -m -d /data/mysqldb -s /sbin/nologin mysql
4)編譯安裝
[root@centos6 ~]# tar xf mariadb-10.2.15.tar.gz
[root@centos6 ~]# cd mariadb-10.2.15
[root@centos6 mariadb-10.2.15]# cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/data/mysqldb/ \
-DSYSCONFDIR=/etc \
-DMYSQL_USER=mysql \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITHOUT_MROONGA_STORAGE_ENGINE=1 \
-DWITH_DEBUG=0 \
-DWITH_READLINE=1 \
-DWITH_SSL=system \
-DWITH_ZLIB=system \
-DWITH_LIBWRAP=0 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
[root@centos6 mariadb-10.2.15]# make -j4 make install
5)配置環境變量、修改軟件安裝目錄權限
[root@centos6 ~]# echo "export PATH=/usr/local/mysql/bin:\$PATH" >/etc/profile.d/mysql.sh
[root@centos6 ~]# . /etc/profile.d/mysql.sh
[root@centos6 ~]# setfacl -R -m u:mysql:rwx /usr/local/mysql/
7)初始化數據庫、提供配置文件、提供服務啟動腳本
[root@centos6 ~]# cd /usr/local/mysql/
[root@centos6 mysql]# scripts/mysql_install_db --datadir=/data/mysqldb/ --user=mysql --basedir=/usr/local/mysql/
[root@centos6 mysql]# cp support-files/my-huge.cnf /etc/my.cnf
[root@centos6 mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[root@centos6 mysql]# chkconfig --add mysqld
8)啟動并測試
[root@centos6 mysql]# service mysqld start
[root@centos6 mysql]# mysql #連接成功則說明OK!
到此這篇關于MySQL系列之一 MariaDB-server安裝的文章就介紹到這了,更多相關MySQL MariaDB-server安裝內容請搜索腳本之家以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持腳本之家!
您可能感興趣的文章:- mysql安裝圖解 mysql圖文安裝教程(詳細說明)
- windows下MySQL5.6版本安裝及配置過程附有截圖和詳細說明
- mysql 5.5 安裝配置方法圖文教程
- linux下安裝apache與php;Apache+PHP+MySQL配置攻略
- MySQL 5.7 版本的安裝及簡單使用(圖文教程)
- Mac下安裝mysql5.7 完整步驟(圖文詳解)
- linux下講解MySQL安裝與登錄方法
- 在windows10上安裝mysql詳細圖文教程
- mysql 5.6.17 綠色版(免安裝)安裝配置教程
- MySQL安裝詳解圖文版(V5.5 For Windows)