环境:centos 6.5
mariadb:mariadb-10.1.14
一、环境准备:
yum install -y ncurses-devel openssl-devel openssl
创建用户:useradd mysql -s /sbin/nologin -M
安装cmake
tar -zxvf cmake-2.8.8.tar.gz
cd cmake-2.8.8
./configure
gmake
gmake install
二、编译安装
tar -zxvf mariadb-10.1.14.tar.gz
cd mariadb-10.1.14
cmake . -DCMAKE_INSTALL_PREFIX=/application/mariadb-10.1.14 -DMYSQL_DATADIR=/application/mariadb-10.1.14/data -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_LIBWRAP=0 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_MYISAM_STORAGE_ENGINE=1
make
make install
#说明
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql
//安装目录
-DINSTALL_DATADIR=/mydata/data
//数据库存放目录
-DDEFAULT_CHARSET=utf8
//使用utf8字符
-DDEFAULT_COLLATION=utf8_general_ci
//校验字符
-DEXTRA_CHARSETS=all
//安装所有扩展字符集
-DENABLED_LOCAL_INFILE=1
//允许从本地导入数据
2、初始化数据库:
cp /application/mariadb/support-files/my-large.cnf /etc/my.cnf #复制配置文件,在解压包里也有这个文件哦,
chown -R 1777 /tmp #有的socket是放在socket,有的是放在data目录下,主要看你配置文件和编译的时候参数
chown -R mysql:mysql /application/mariadb/data/
初始化:
/application/mariadb/scripts/mysql_install_db –basedir=/application/mariadb –datadir=/application/mariadb/data/ –user=mysql
以下是初始化出现的:
To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER ! To do so, start the server, then issue the following commands: '/application/mariadb/bin/mysqladmin' -u root password 'new-password' '/application/mariadb/bin/mysqladmin' -u root -h node-test2 password 'new-password' Alternatively you can run: '/application/mariadb/bin/mysql_secure_installation' which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the MariaDB Knowledgebase at http://mariadb.com/kb or the MySQL manual for more instructions. You can start the MariaDB daemon with: cd '/application/mariadb' ; /application/mariadb/bin/mysqld_safe --datadir='/application/mariadb/data/' You can test the MariaDB daemon with mysql-test-run.pl cd '/application/mariadb/mysql-test' ; perl mysql-test-run.pl Please report any problems at http://mariadb.org/jira The latest information about MariaDB is available at http://mariadb.org/. You can find additional information about the MySQL part at: http://dev.mysql.com Support MariaDB development by buying support/new features from MariaDB Corporation Ab. You can contact us about this at sales@mariadb.com. Alternatively consider joining our community based development effort: http://mariadb.com/kb/en/contributing-to-the-mariadb-project/
3、配置启动和环境变量:
cp /application/mariadb/support-files/mysql.server /etc/init.d/mariadbd
echo “export PATH=$PATH:/application/mariadb/bin” >> /etc/profile
source /etc/profile
[root@node-test2 ~]# /etc/init.d/mariadbd start Starting MySQL. SUCCESS! [root@node-test2 ~]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.5.5-10.1.14-MariaDB Source distribution Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.00 sec) mysql> select version(); +-----------------+ | version() | +-----------------+ | 10.1.14-MariaDB | +-----------------+ 1 row in set (0.00 sec) mysql>
原文链接:mariadb的安装,转载请注明来源!