• 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=etcmysql

    -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


     

    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)


     

    make && make install 

    完成安装:


     

    【初始化数据库时 报错:

    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

     


    初始登录密码如高亮处

    启动:

    bin/mysqld_safe --user=mysql &

    登录 :

    /usr/local/bin/mysql -u root -p


    修改密码:

    alter user user() identified by ‘123456’

  • 相关阅读:
    C语言经典编程例子
    C语言编程例子-判断字母是否大写
    C语言编程例子-判断偶数
    C语言编程例子-打印乘法口诀表
    C语言编程例子-特殊等式
    C语言编程例子-一元钱的兑换方案
    C语言编程例子-使用while为用户提供菜单显示
    C语言编程例子-使用while语句求n
    C语言编程例子-检查字符类型
    C语言编程例子-求最低分和最高分
  • 原文地址:https://www.cnblogs.com/cyanrose/p/11471455.html
Copyright © 2020-2023  润新知