配置说明
Linux版本:Centos7
MySQL版本:MySQL5.7.16
该文档适用于MySQL版本>=5.7.6
一、卸载CentOS7默认携带的mariadb包
# 检查mariadb安装包[root@wing ~]# rpm -qa | grep -i mysql[root@wing ~]# rpm -qa | grep -i mariadbmariadb-libs-5.5.50-1.el7_2.x86_64# 卸载mariadb安装包[root@wing ~]# rpm -e mariadb-libs-5.5.50-1.el7_2.x86_64error: Failed dependencies: libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64 libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64[root@wing ~]# rpm -e mariadb-libs-5.5.50-1.el7_2.x86_64 postfix-2:2.10.1-6.el7.x86_64 |
二、获得MySQL所有版本(5.0.15-latest)地址传送门
http://downloads.mysql.com/archives/community/
三、安装编译软件
yum install -y cmake make gcc gcc-c++ |
四、创建MySQL安装目录
# 如MySQL安装目录为:/usr/local/mysqlmkdir -p /usr/local/mysql |
五、解压MySQL源码包
tar -zxvf mysql-5.7.16.tar.gz |
六、创建mysql用户和用户组
# 创建用户组groupadd mysql# 创建mysql用户,所属组为mysqluseradd -s /bin/bash -m -g mysql mysql |
七、安装MySQL相关依赖包
yum install -y ncurses-devel openssl-devel bison-devel libaio libaio-devel |
八、boost库安装
# 该步骤可以省略,在cmake阶段添加参数-DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost即可# boost库安装wget http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gztar -zxvf boost_1_59_0.tar.gz -C /usr/localmv /usr/local/boost_1_59_0 /usr/local/boostcd /usr/local/boost./bootstrap.sh./b2 stage threading=multi link=shared./b2 install threading=multi link=shared |
九、创建MySQL相关目录
| 目录 | 含义 | 配置参数 |
| :——— | ————————————– | —————————————- |
| bin_log | 二进制日志目录 | log_bin_basename
log_bin_index |
| mydata | 数据文件目录 | datadir |
| innodb_log | InnoDB重做日志目录 | innodb_log_group_home_dir |
| innodb_ts | InnoDB共享表空间目录 | innodb_data_home_dir |
| log | 日志文件目录(error log+general log+slow log) | log_error
general_log_file
slow_query_log_file |
| relay_log | InnoDB中继日志目录 | relay_log_basename
relay_log_index |
| tmpdir | 临时文件目录 | tmpdir |
| undo_log | InnoDB回滚日志目录 | innodb_undo_directory |
mkdir -p /data/mysql/mysql3306/bin_logmkdir -p /data/mysql/mysql3306/db_filemkdir -p /data/mysql/mysql3306/innodb_logmkdir -p /data/mysql/mysql3306/innodb_tsmkdir -p /data/mysql/mysql3306/logmkdir -p /data/mysql/mysql3306/relay_logmkdir -p /data/mysql/mysql3306/tmpdirmkdir -p /data/mysql/mysql3306/undo_log |