你的位置:首页 > 数据库

[数据库]手把手教你编译安装MariaDB

MariaDB是什么?

MariaDB是MySQL的一个分支,由于Oracle有可能对MySQL闭源,所以分离了出来(MySQL先后被Sun、Oracle收购)。

但是除了作为一个Mysql的“向下替代品”,MariaDB包括的一些新特性使它优于MySQL。

官网说明

The instructions on this page will help you compile MariaDB from source. Links to more complete instructions for specific platforms can be found on the source page.

First, get a copy of the MariaDB source.

Next, prepare your system to be able to compile the source.

If you don't want to run MariaDB as yourself, then you should create amysql user. The example below uses this user.

Using cmake (MariaDB starting with 5.5)

MariaDB 5.5 and above is compiled using cmake. You can configure your build simply by running cmake without any special options, like

cmake .

but if you want it to be configured exactly as we do for our releases, use

cmake . -DBUILD_CONFIG=mysql_release

All cmake configuration options for MariaDB can be displayed with:

cmake . -LH

To build and install MariaDB after running cmake use

makesudo make install

If the commands above fail, you can enable more compilation information by doing:

make VERBOSE=1

以上摘自:https://mariadb.com/kb/en/mariadb/generic-build-instructions/

cmake的选项和mysql的cmake相似,可供参考(中文文档):http://www.blogjava.net/kelly859/archive/2012/09/04/387005.html

测试实践

编译实践

#解压

tar xfz mariadb-10.0.16.tar.gz

  #进入安装目录

cd mariadb

 #配置 

cmake . -DCMAKE_INSTALL_PREFIX=/opt/waTeam/mariadb -DMYSQL_DATADIR=/home/datas/mariadb/data/ -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci

 
#编译 约半小时时间

make

 #安装

 
make install
 至此,MariaDB编译安装完成。