centos7源码安装mysql5.7
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7源码安装mysql5.7相关的知识,希望对你有一定的参考价值。
- 下载:
https://dev.mysql.com/downloads/mysql/ 或 https://github.com/dollarphper/soft/blob/master/mysql/mysql-boost-5.7.24.tar.gz
- 安装依赖:
yum -y install cmake gcc gcc-c++ ncurses ncurses-devel libaio-devel openssl openssl-devel
- 创建用户:
useradd mysql -s /sbin/nologin -M
- 创建文件夹:
mkdir -p /usr/local/mysql/data
- 解压:
tar -xzf mysql-boost-5.7.24.tar.gz
- 编译安装:
cd mysql-5.7.24 cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc -DMYSQL_TCP_PORT=3306 -DWITH_BOOST=./boost make && make install
- 修改所属主为mysql:
chown -R mysql.mysql /usr/local/mysql
- 修改配置文件:
vim /etc/my.cnf[mysqld] server-id=1 port=3306 basedir=/usr/local/mysql datadir=/usr/local/mysql/data ngram_token_size=2
- 初始化:
/usr/local/mysql/bin/mysqld --initialize-insecure --user=mysql --datadir=/usr/local/mysql/data
- 启动服务:
/usr/local/mysql/bin/mysqld_safe --user=mysql &
以上是关于centos7源码安装mysql5.7的主要内容,如果未能解决你的问题,请参考以下文章