作者:我我檬檬我我186 | 2021-08-10 20:20
今天在紫桐看到cnk8sky推荐MariaDB,说是超级给力。google搜了一下,看到好多公司逃离MySQL转投MariaDB旗下,想必其必有过人之处,心痒难耐,忍不住装一个试试。困了,先不??铝耍?苯咏?胫魈狻!!!?--------------------------------------------我
今天在紫桐看到cnk8sky推荐MariaDB,说是超级给力 。google搜了一下,看到好多公司逃离MySQL转投MariaDB旗下,想必其必有过人之处,心痒难耐,忍不住装一个试试
。
困了 ,先不??铝耍?苯咏?胫魈狻!!!?br />
---------------------------------------------我是照例出场的分割线------------------------------------------------------
先更新系统
aptitude update && aptitude -y full-upgrade
安装编译环境
aptitude -y install build-essential libcloog-ppl0
建立源文件存放目录
mkdir /opt/sources
chmod +X /opt/sources
安装编译MariaDB所需的库文件
aptitude -y install cmake libev-libevent-dev libncurses5-dev bison
创建运行数据库程序的用户及用户组
groupadd
mysql
useradd -M -s /sbin/nologin -g mysql mysql
下面正式开始干活
cd /opt/sources
wget http://ftp.osuosl.org/pub/mariadb/mariadb-10.0.1/kvm-tarbake-jaunty-x86/mariadb-10.0.1.tar.gz
tar -zxvf mariadb-10.0.1.tar.gz
cd mariadb-10.0.1
CC=gcc
CXX=g++
CHOST="x86_64-pc-linux-gnu"
CFLAGS="-O3 \
-fomit-frame-pointer \
-march=native \
-pipe \
-mmmx \
-mfpmath=sse \
-m128bit-long-double \
-m64 \
-maccumulate-outgoing-args \
-ftree-loop-linear \
-fprefetch-loop-arrays \
-fno-omit-frame-pointer \
-freg-struct-return \
-fgcse-sm \
-fgcse-las \
-fforce-addr \
-fivopts \
-ftree-vectorize \
-ftracer \
-frename-registers \
-minline-all-stringops \
-fbranch-target-load-optimize2"
CXXFLAGS="${CFLAGS}"
export CXX CFLAGS CXXFLAGS
cmake . \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_INSTALL_PREFIX:PATH=/usr/local/mysql \
-DENABLE_DEBUG_SYNC:BOOL=OFF \
-DMYSQL_DATADIR:PATH=/var/lib/mysql \
-DUSE_ARIA_FOR_TMP_TABLES:BOOL=ON \
-DWITHOUT_PBXT_STORAGE_ENGINE:BOOL=ON \
-DWITH_ARCHIVE_STORAGE_ENGINE:BOOL=ON \
-DWITH_ARIA_STORAGE_ENGINE:BOOL=ON \
-DWITH_BLACKHOLE_STORAGE_ENGINE:BOOL=OFF \
-DWITH_EMBEDDED_SERVER:BOOL=OFF \
-DWITH_EXTRA_CHARSETS:STRING=all \
-DWITH_FEDERATEDX_STORAGE_ENGINE:BOOL=OFF \
-DWITH_FEEDBACK:BOOL=OFF \
-DWITH_INNOBASE_STORAGE_ENGINE:BOOL=ON \
-DWITH_LIBWRAP:BOOL=OFF \
-DWITH_PARTITION_STORAGE_ENGINE:BOOL=ON \
-DWITH_PERFSCHEMA_STORAGE_ENGINE:BOOL=ON \
-DWITH_SSL:STRING=system \
-DWITH_ZLIB:STRING=system
make -j4
make install
创建数据库所需目录并更改所有权
mkdir /var/run/mysqld
mkdir /var/log/mysql
mkdir -p /var/lib/mysql
mkdir /etc/mysql
chown -R mysql:mysql /usr/local/mysql/
chown -R mysql:mysql /var/run/mysqld/
chown -R mysql:mysql /var/log/mysql/
chown -R mysql:mysql /var/lib/mysql/
复制配置文件
cp support-files/my-medium.cnf /etc/mysql/my.cnf
复制启动脚本并将其设置为系统服务
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
insserv mysqld
安装数据库系统表
cd /usr/local/mysql/scripts
./mysql_install_db --basedir=/usr/local/mysql --datadir=/var/lib/mysql --user=mysql
启动数据库程序
cd /usr/local/mysql
/usr/local/mysql/bin/mysqld_safe &
更改root用户密码
/usr/local/mysql/bin/mysqladmin -u root password 'MyTest@MyTEST'
测试root用户
/usr/local/mysql/bin/mysql -u root -p'MyTest@MyTEST'
\q
----------------------------------------------我是不请自来的分割线-------------------------------------------------------
整个安装和MySQL大同小异,可惜没有时间测试它的性能了 。