- 下载源码包
- 进网站选 5.5 mariadb
- 传到要安装的主机
- 解包
tar -zxvf mariadb-5.5.66.tar.gz
-
安装包
yum install bison bison-devel zlib-devel libcurl-devel libarchive-devel boost-devel gcc gcc-c cmake ncurses-devel gnutls-devel libxml2-devel openssl-devel libevent-devel libaio-devel libdb-cxx-devel
-
cmake 编译安装
cmake . -DCMAKE_INSTALL_PREFIX=/app/mysql -DMYSQL_DATADIR=/data/mysql/ -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=/data/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci make && make install # 提示:如果出错,执行rm -f CMakeCache.txt
-
准备环境变量
echo 'PATH=/app/mysql/bin:$PATH' > /etc/profile.d/mysql.sh . /etc/profile.d/mysql.sh
-
生成数据库文件
cd /app/mysql/ scripts/mysql_install_db --datadir=/data/mysql/ --user=mysql
-
准备配置文件
cp /app/mysql/support-files/my-huge.cnf /etc/my.cnf
-
准备启动脚本
cp /app/mysql/support-files/mysql.server /etc/init.d/mysqld
-
启动服务
chkconfig --add mysqld ;service mysqld start