- 下载CMAKEhttps://cmake.org/download/
- 解压文件
tar -zxvf cmake-3.6.0-rc3.tar.gz
- 安装GCC
yum install gcc-c++
- 切换到cmake目录
cd cmake-3.6.0-rc3
- 执行configure文件
./configure
- 安装
make && make install
- 下载mariadbhttps://downloads.mariadb.org/mariadb/
- 解压文件
tar -zxvf mariadb-10.1.14.tar.gz
- 切换到mariadb目录
cd mariadb-10.1.14
- 创建mysql用户组及用户
groupadd mysql useradd -g mysql mysql
- 创建安装目录和数据目录
mkdir /usr/local/mariadb mkdir /usr/local/mariadb/data chown -R mysql:mysql /usr/local/mariadb
- 安装ncurses-devel
yum install ncurses-devel
- 编译
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb -DMYSQL_DATADIR=/usr/local/mariadb/data -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
- 安装
make && make install
- 删除旧配置文件复制新文件
rm -f /etc/my.cnf cp /usr/local/mariadb/support-files/my-large.cnf /etc/my.cnf
- 初始化数据库
/usr/local/mariadb/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb --datadir=/usr/local/mariadb/data
- 添加环境变量
- 运行命令打开系统文件
vi /etc/profile
- 在最后加上
MYSQL_HOME=/usr/local/mariadb PATH=$MYSQL_HOME/bin:$PATH export PATH
mariadb开机自启动cp /usr/local/mariadb/support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
时间: 2024-10-08 13:43:30