2.1 下载mysql
网址:https://www.mysql.com/ [root@localhost ~]# mkdir -p /root/soft/MySQL [root@localhost ~]# cd /root/soft/MySQL/ [root@localhost MySQL]# wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-boost-5.7.20.tar.gz
2.2 下载openssl
网址:https://www.openssl.org/ [root@localhost MySQL]# wget https://www.openssl.org/source/openssl-1.0.2l.tar.gz
2.3 安装openssl
[root@localhost MySQL]# tar xf openssl-1.0.2l.tar.gz [root@localhost MySQL]# cd openssl-1.0.2l [root@localhost openssl-1.0.2l]# ./config --prefix=/usr/local/openssl --openssldir=/usr/local/ssl -fPIC no-gost no-shared no-zlib [root@localhost openssl-1.0.2l]# make [root@localhost openssl-1.0.2l]# make install
2.4 安装mysql
[root@localhost openssl-1.0.2l]# clear [root@localhost openssl-1.0.2l]# cd .. [root@localhost MySQL]# .tar.gz [root@localhost MySQL]# cd mysql-/ [root@localhost mysql-]# cp boost/ /usr/local/boost -R [root@localhost mysql-]# yum install cmake [root@localhost mysql-]# mkdir -p /data [root@localhost mysql-]# /data/ [root@localhost mysql-]# 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= -DWITH_BLACKHOLE_STORAGE_ENGINE= [root@localhost mysql-]# make [root@localhost mysql-]# make install
2.5 初始化mysql
[root@localhost mysql-]# useradd mysql -s /sbin/nologin [root@localhost mysql-]# /usr/local/mysql/bin/mysqld --initialize --datadir=/data/ --user=mysql --basedir=/usr/local/mysql/ --collation-server=utf8_general_ci
2.6 报错和解决之道
问题:
[root@localhost openssl-1.0.2l]# ./config --prefix=/usr/local/openssl --openssldir=/usr/local/ssl -fPIC no-gost no-shared no-zlib Operating system: x86_64-whatever-linux2 You need Perl .
解决;
[root@localhost openssl-1.0.2l]# yum install perl perl-devel
问题;
[root@localhost openssl-1.0.2l]# make making all in crypto... ]: Entering directory `/root/soft/Apache/openssl-1.0.2l/crypto' /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 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 ]: gcc: Command not found ]: *** [cryptlib.o] Error ]: Leaving directory `/root/soft/Apache/openssl-1.0.2l/crypto' [root@localhost openssl-1.0.2l]#
解决:
[root@localhost openssl-1.0.2l]# yum install gcc gcc-c++
问题:
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH) CMake Error at cmake/readline.cmake: (MESSAGE): Curses library not found. Please install appropriate package,
解决:
[root@localhost mysql-]# yum install ncurses ncurses-devel [root@localhost mysql-]# rm -f CMakeCache.txt