建用户与组
groupadd mysql
useradd -g mysql mysql
下载源码:
wget https://downloads.mariadb.org/interstitial/mariadb-10.1.10/source/mariadb-10.1.10.tar.gz
tar -xvf mariadb-10.1.10.tar.gz
1、编译:
cmake . -DCMAKE_INSTALL_PREFIX=/var/lib/mysql3377/ -DMYSQL_DATADIR=/var/lib/mysql3377/data/ -DSYSCONFDIR=/var/lib/mysql3377/etc -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/mysql3377.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make
make install
2、初始化db
/var/lib/mysql3377/scripts/mysql_install_db --user=mysql --datadir=/var/lib/mysql3377/data/
3、复制my.cnf
#cp support-files/my-medium.cnf /var/lib/mysql3377/etc/my.cnf
4、修改my.cnf
5、复制mysql.server至/etc/rc.d/init.d
cp support-files/mysql.server /etc/rc.d/init.d/mysql3377
6、修改权限
chmod +x /etc/rc.d/init.d/mysql3377
7、修改mysql3377
vim /etc/rc.d/init.d/mysql3377 修改2处地方:
1)conf=/var/lib/mysql3377/etc/my.cnf
2)
8、修改目录权限
chown -R root:mysql /var/lib/mysql3377/
chown -R mysql:mysql /var/lib/mysql3377/data/
9、添加自启动
chkconfig mysql3377 on
10、配置第二个数据库:
清除编译文件
make clean
rm CMakeCache.txt
重复1-9步即可。