2.1 下载mysql
1 网址:https://www.mysql.com/ 2 [root@localhost ~]# mkdir -p /root/soft/MySQL 3 [root@localhost ~]# cd /root/soft/MySQL/ 4 [root@localhost MySQL]# wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-boost-5.7.20.tar.gz
2.2 下载openssl
1 网址:https://www.openssl.org/ 2 [root@localhost MySQL]# wget https://www.openssl.org/source/openssl-1.0.2l.tar.gz
2.3 安装openssl
1 [root@localhost MySQL]# tar xf openssl-1.0.2l.tar.gz 2 [root@localhost MySQL]# cd openssl-1.0.2l 3 [root@localhost openssl-1.0.2l]# ./config --prefix=/usr/local/openssl --openssldir=/usr/local/ssl -fPIC no-gost no-shared no-zlib 4 [root@localhost openssl-1.0.2l]# make 5 [root@localhost openssl-1.0.2l]# make install
2.4 安装mysql
1 [root@localhost openssl-1.0.2l]# clear 2 [root@localhost openssl-1.0.2l]# cd .. 3 [root@localhost MySQL]# tar xf mysql-boost-5.7.20.tar.gz 4 [root@localhost MySQL]# cd mysql-5.7.20/ 5 [root@localhost mysql-5.7.20]# cp boost/ /usr/local/boost -R 6 [root@localhost mysql-5.7.20]# yum install cmake 7 [root@localhost mysql-5.7.20]# mkdir -p /data 8 [root@localhost mysql-5.7.20]# chmod 777 /data/ 9 [root@localhost mysql-5.7.20]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DWITH_BOOST=/usr/local/boost -DMYSQL_DATADIR=/data -DDEFAULT_CHARSET=utf8 -DWITH_SSL=/usr/local/openssl -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 10 [root@localhost mysql-5.7.20]# make 11 [root@localhost mysql-5.7.20]# make install
2.5 初始化mysql
1 [root@localhost mysql-5.7.20]# useradd mysql -s /sbin/nologin 2 [root@localhost mysql-5.7.20]# /usr/local/mysql/bin/mysqld --initialize --datadir=/data/ --user=mysql --basedir=/usr/local/mysql/ --collation-server=utf8_general_ci
2.6 报错和解决之道
问题:
1 [root@localhost openssl-1.0.2l]# ./config --prefix=/usr/local/openssl --openssldir=/usr/local/ssl -fPIC no-gost no-shared no-zlib 2 Operating system: x86_64-whatever-linux2 3 You need Perl 5.
解决;
1 [root@localhost openssl-1.0.2l]# yum install perl perl-devel
问题;
1 [root@localhost openssl-1.0.2l]# make 2 making all in crypto... 3 make[1]: Entering directory `/root/soft/Apache/openssl-1.0.2l/crypto' 4 /usr/bin/perl ../util/mkbuildinf.pl "gcc -I. -I.. -I../include -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -fPIC -m64 -DL_ENDIAN -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM" "linux-x86_64" >buildinf.h 5 gcc -I. -I.. -I../include -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -fPIC -m64 -DL_ENDIAN -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -c -o cryptlib.o cryptlib.c 6 make[1]: gcc: Command not found 7 make[1]: *** [cryptlib.o] Error 127 8 make[1]: Leaving directory `/root/soft/Apache/openssl-1.0.2l/crypto' 9 make: *** [build_crypto] Error 1 10 [root@localhost openssl-1.0.2l]#
解决:
1 [root@localhost openssl-1.0.2l]# yum install gcc gcc-c++
问题:
1 -- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH) 2 CMake Error at cmake/readline.cmake:64 (MESSAGE): 3 Curses library not found. Please install appropriate package,
解决:
1 [root@localhost mysql-5.7.20]# yum install ncurses ncurses-devel 2 [root@localhost mysql-5.7.20]# rm -f CMakeCache.txt