1.创建用户和组
1 [root@centos7A ~]# groupadd mysql 2 [root@centos7A ~]# useradd -r -g mysql -s /bin/false msyql
2.安装mysql
1 (1)安装相关依赖环境 2 [root@centos7A ~]# yum -y install cmake gcc gcc-c++ ncurses ncurses-devel bison make 3 4 (2)5.7版本依赖包boost安装 5 boost依赖包下载地址: 6 https://sourceforge.net/projects/boost/files/boost/ 7 8 [root@centos7A ~]# tar -zxf boost_1_59_0.tar.gz 9 [root@centos7A ~]# mkdir /usr/local/boost 10 [root@centos7A ~]# mv boost_1_59_0/* /usr/local/boost/ 11 12 (3)编译安装mysql 13 [root@centos7A ~]# tar -zxf mysql-5.7.24.tar.gz 14 [root@centos7A ~]# cd mysql-5.7.24 15 [root@centos7A mysql-5.7.24]# cmake 16 -DCMAKE_INSTALL_PREFIX=/usr/local/mysql 17 -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock 18 -DSYSCONFDIR=/etc 19 -DSYSTEMD_PID_DIR=/usr/local/mysql 20 -DDEFAULT_CHARSET=utf8 21 -DDEFAULT_COLLATION=utf8_general_ci 22 -DWITH_INNOBASE_STORAGE_ENGINE=1 23 -DWITH_ARCHIVE_STORAGE_ENGINE=1 24 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 25 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 26 -DMYSQL_DATADIR=/usr/local/mysql/data 27 -DWITH_BOOST=/usr/local/boost 28 -DWITH_SYSTEMD=1 29 [root@centos7A ~]# make && make install 30 完成安装