mysql8 安装
准备工作:
首先安装这些依赖
yum install -y flex
yum install gcc gcc-c++ cmake ncurses ncurses-devel bison libaio-devel libncurses-devel libopenssl-devel zlib-devel autoconf perl per-devel openssl gcc-g77 make - y
升级make
wget https://kojipkgs.fedoraproject.org//packages/make/4.2.1/14.fc31/src/make-4.2.1-14.fc31.src.rpm
./configure --prefix=/usr
make make install
下载 cmake 3.5 以上版本:
wget https://cmake.org/files/v3.6/cmake-3.6.3.tar.gz
解压后 执行:
./bootstrap
gmake && gmake --install
升级gcc:
https://kojipkgs.fedoraproject.org//packages/gcc/7.3.1/1.fc26/src/gcc-7.3.1-1.fc26.src.rpm
进入gcc目录,安装gcc依赖库
cd gcc && ./contrib/download_prerequisites
执行命令后它会自动下载mpfr、gmp、mpc isl这4个库
编译安装 gcc
升级 openssl
wget https://www.openssl.org/source/openssl-1.1.1c.tar.gz
解压后安装:
mkdir build &&cd build
../configure
make
make install
下载mysql
wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-boost-8.0.16.tar.gz
编译安装:
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data/ \
-DSYSCONFDIR=\etc\mysql\
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8mb4 \
-DWITH_BOOST=/home/mysql-8/mysql-8.0.16/boost \
-DFORCE_INSOURCE_BUILD=1
报错:
【CMake Error at /usr/local/share/cmake-3.6/Modules/CMakeTestCCompiler.cmake:61 (message):】
【cc: error trying to exec 'cc1': execvp: No such file or directory】
修改CMakeCache.txt文件中的
CMAKE_CXX_COMPILER:FILEPATH=/usr/local/bin/c++
CMAKE_C_COMPILER:FILEPATH=/usr/local/bin/gcc
报错:
【CMake Error at CMakeLists.txt:301 (MESSAGE):】
增加参数: -DFORCE_INSOURCE_BUILD=1
make
报错:
【../runtime_output_directory/uca9dump: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ../runtime_output_directory/uca9dump)
make[2]: *** [strings/CMakeFiles/strings.dir/build.make:64: strings/uca900_zh_tbls.cc] Error 1
make[1]: *** [CMakeFiles/Makefile2:1022: strings/CMakeFiles/strings.dir/all] Error 2】
解决:
查看 /lib64/libstdc++.so.6 版本
strings /lib64/libstdc++.so.6 | grep CXXABI
CXXABI_1.3
CXXABI_1.3.1
CXXABI_1.3.2
CXXABI_1.3.3
CXXABI_1.3.4
CXXABI_1.3.5
CXXABI_1.3.6
CXXABI_1.3.7
CXXABI_TM_1
版本不符合要求 , 由于gcc安装在/usr/bin/local 中,故执行如下操作 :
ln -s /usr/local/lib64/libstdc++.so.6 /lib64/libstdc++.so.6
ln -s /usr/local/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6
报错:
【/home/mysql-8/mysql-8.0.16/storage/innobase/include/os0atomic.ic:194:2: error: #error "Unsupported platform"
#error "Unsupported platform"】问题解决:
vim /home/mysql-8/mysql-8.0.16/storage/innobase/include/os0atomic.h
1 由于没有定义arm平台的宏定义,增加参数如下:
#else
#define HAVE_ATOMIC_BUILTINS
![](https://upload-images.jianshu.io/upload_images/19094133-071093203447c6f1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://img2018.cnblogs.com/blog/1789230/201909/1789230-20190906102601840-1862275972.png)
2 vim /home/mysql-8/mysql-8.0.16/storage/innobase/include/os0atomic.ic
在os0atomic.ic中,把#elif defined(IB_STRONG_MEMORY_MODEL)改为#elif defined(HAVE_ATOMIC_BUILTINS)
报错:
【/home/mysql-8/mysql-8.0.16/storage/innobase/buf/buf0buf.cc:1220:44: error: 'SYS_gettid' was not declared in this scope
setpriority(PRIO_PROCESS, (pid_t)syscall(SYS_gettid), -20);
】问题解决
vi /home/mysql-8/mysql-8.0.16/storage/innobase/buf/buf0buf.cc
将 SYS_gettid 改为 186
报错:
【/home/mysql-8/mysql-8.0.16/storage/innobase/lock/lock0lock.cc:1571:9: error: 'os_compare_and_swap_thread_id' was not declared in this scope
cas = os_compare_and_swap_thread_id(&trx->killed_by, 0, thread_id);
】问题解决:
os_compare_and_swap_thread_id() 这个函数没有声明.
在os0atomic.h头文件中的第250行左右找到os_compare_and_swap_thread_id()这个函数的实现
修改:
# ifdef HAVE_ATOMIC_BUILTINS //HAVE_IB_ATOMIC_PTHREAD_T_GCC
#if defined(HAVE_ATOMIC_BUILTINS) //defined(HAVE_GCC_SYNC_BUILTINS)
![](https://upload-images.jianshu.io/upload_images/19094133-8e9f70d5dceb382c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
make && make install
完成安装:
![](https://upload-images.jianshu.io/upload_images/19094133-1bba518b37941dba.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://img2018.cnblogs.com/blog/1789230/201909/1789230-20190906102737375-1345081592.png)
【初始化数据库时 报错:
2019-08-28T01:40:06.114368Z 0 [ERROR] [MY-010936] [Server] COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'utf8mb4'】
创建 /et/my.cnf
vim /etc/my.cnf
[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
[mysqld]
skip-grant-tables
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4
初始化mysql
bin/mysqld --initialize --user=mysql
![](https://upload-images.jianshu.io/upload_images/19094133-0f14d8e846fcc390.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
启动:
bin/mysqld_safe --user=mysql &
登录 :
/usr/local/bin/mysql -u root -p
![](https://upload-images.jianshu.io/upload_images/19094133-9b0b445acd7c35ff.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://img2018.cnblogs.com/blog/1789230/201909/1789230-20190906102810786-498698819.png)
修改密码:
alter user user() identified by ‘123456’