MySQL编译安装常见错误

 [root@localhost mysql-5.7.19]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
    > -DSYSCONFDIR=/etc \
    > -DMYSQL_TCP_PORT=3306 \
    > -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
    > -DEFAULT_CHARSET=utf8 \
    > -DMYSQL_DATADIR=/usr/local/mysql/data \
    > -DENABLED_LOCAL_INFILE=1 \
    > -DEXTRA_CHARSETS=all \
    > -DDEFAULT_COLLATION=utf8_general_ci \
    > -DDOWNLOAD_BOOST=1 \
    > -DWITH_BOOST=/usr/local/src/boost_1_59_0
    -- Running cmake version 2.8.11
    -- Could NOT find Git (missing: GIT_EXECUTABLE)
    -- Configuring with MAX_INDEXES = 64U
    -- The C compiler identification is unknown
    -- The CXX compiler identification is unknown
    CMake Error: your C compiler: "CMAKE_C_COMPILER-NOTFOUND" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name.
    CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or
    name.
    -- CMAKE_GENERATOR: Unix Makefiles
    CMake Error at cmake/os/Linux.cmake:41 (MESSAGE):
    Unsupported compiler!
    Call Stack (most recent call first):
    CMakeLists.txt:169 (INCLUDE)
    -- Configuring incomplete, errors occurred!
    [root@localhost mysql-5.7.19]# gcc
    bash: gcc: 未找到命令...                    
    **报错原因:没安装gcc**      
 [root@CentOS73-1 mysql-5.7.19]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc -DMYSQL_TCP_PORT=3306 -DMYSQL_UNIX_ADDR=/
    var/lib/mysql/mysql.sock -DEFAULT_CHA
    RSET=utf8 -DMYSQL_DATADIR=/usr/local/mysql/data -DENABLED_LOCAL_INFILE=1 -DEXTRA_CHARSETS=all -DDEFAULT_COLLATION=utf8_general_ci -
    DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/loca
    l/src/boost_1_59_0
    -- Running cmake version 2.8.12.2
    -- Could NOT find Git (missing: GIT_EXECUTABLE)
    -- Configuring with MAX_INDEXES = 64U
    -- The CXX compiler identification is unknown
    CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or
    name.
    -- CMAKE_GENERATOR: Unix Makefiles
    -- SIZEOF_VOIDP 8
    -- MySQL 5.7.19
    -- Packaging as: mysql-5.7.19-Linux-x86_64
    -- Local boost dir /usr/local/src/boost_1_59_0
    -- Found /usr/local/src/boost_1_59_0/boost/version.hpp
    -- BOOST_VERSION_NUMBER is #define BOOST_VERSION 105900
    -- BOOST_INCLUDE_DIR /usr/local/src/boost_1_59_0
    -- NUMA library missing or required version not available
    -- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
    CMake Error at cmake/readline.cmake:64 (MESSAGE):
    Curses library not found. Please install appropriate package,
    remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncursesdevel.
    Call Stack (most recent call first):
    cmake/readline.cmake:107 (FIND_CURSES)
    cmake/readline.cmake:197 (MYSQL_USE_BUNDLED_EDITLINE)
    CMakeLists.txt:519 (MYSQL_CHECK_EDITLINE)
    -- Configuring incomplete, errors occurred!
    See also "/usr/local/src/mysql-5.7.19/CMakeFiles/CMakeOutput.log".
    See also "/usr/local/src/mysql-5.7.19/CMakeFiles/CMakeError.log".
       **报错原因:没安装 ncurses-devel**  
CMake Error: Internal CMake error, TryCompile configure of cmake failed
    -- Performing Test HAVE_NO_BUILTIN_MEMCMP - Failed
    CMake Warning at cmake/bison.cmake:20 (MESSAGE):
    Bison executable not found in PATH
    Call Stack (most recent call first):
    sql/CMakeLists.txt:548 (INCLUDE)
    CMake Warning at cmake/bison.cmake:20 (MESSAGE):
    Bison executable not found in PATH
    Call Stack (most recent call first):
    libmysqld/CMakeLists.txt:187 (INCLUDE)
    -- Library mysqlserver depends on OSLIBS -lpthread;m;rt;crypt;dl
    -- INSTALL mysqlclient.pc lib/pkgconfig
    -- Skipping deb packaging on unsupported platform .
    -- CMAKE_BUILD_TYPE: RelWithDebInfo
    -- COMPILE_DEFINITIONS: _GNU_SOURCE;_FILE_OFFSET_BITS=64;HAVE_CONFIG_H;HAVE_LIBEVENT1
    -- CMAKE_C_FLAGS: -Wall -Wextra -Wformat-security -Wvla -Wwrite-strings -Wdeclaration-after-statement
    -- CMAKE_CXX_FLAGS:
    -- CMAKE_C_LINK_FLAGS:
    -- CMAKE_CXX_LINK_FLAGS:
    -- CMAKE_C_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
    -- CMAKE_CXX_FLAGS_RELWITHDEBINFO: -DDBUG_OFF
    -- Configuring incomplete, errors occurred!
    See also "/usr/local/src/mysql-5.7.19/CMakeFiles/CMakeOutput.log".
    See also "/usr/local/src/mysql-5.7.19/CMakeFiles/CMakeError.log".
    报错原因:没有安装gcc-c++           
[root@CentOS73-1 mysql-5.7.19]# make -j4
    [ 0%] Built target zlib
    [ 0%] Built target INFO_BIN
    [ 0%] Built target INFO_SRC
    [ 1%] Built target yassl
    [ 3%] Built target taocrypt
    [ 5%] Built target edit
    [ 7%] Built target strings
    [ 8%] Built target mysqlservices
    Linking C static library liblz4_lib.a
    [ 8%] Built target gen_lex_hash
    [ 8%] Built target vio
    [ 8%] [ 9%] Built target lz4_lib
    Built target regex
    [ 9%] Built target comp_sql
    [ 9%] Built target abi_check
   [ 9%] [ 10%] [ 10%] Building CXX object rapid/plugin/group_replication/CMakeFiles/gr_unit_test_resource.dir/src/member_info.cc.o 
    Built target event
    Scanning dependencies of target protobuf-lite
    Built target GenLiteProtos
    Scanning dependencies of target protobuf
    Scanning dependencies of target protoclib
    [ 10%] Building CXX object extra/protobuf/CMakeFiles/protobuf-lite.dir/protobuf-2.6.1/src/google/protobuf/stubs/
    atomicops_internals_x86_gcc.cc.o
    In file included from /usr/local/src/mysql-5.7.19/rapid/plugin/group_replication/include/plugin_server_include.h:38:0,
    from /usr/local/src/mysql-5.7.19/rapid/plugin/group_replication/include/plugin_psi.h:19,
    from /usr/local/src/mysql-5.7.19/rapid/plugin/group_replication/src/member_info.cc:17:
    /usr/local/src/mysql-5.7.19/include/my_atomic.h:64:4: error: #error Native atomics support not found!
    # error Native atomics support not found!
    ^
    [ 10%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/code_generator.cc.o
    [ 10%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/stubs/strutil.cc.o
    [ 10%] Building CXX object extra/protobuf/CMakeFiles/protobuf-lite.dir/protobuf-2.6.1/src/google/protobuf/stubs/
    atomicops_internals_x86_msvc.cc.o
    make[2]: *** [rapid/plugin/group_replication/CMakeFiles/gr_unit_test_resource.dir/src/member_info.cc.o] Error 1
    make[1]: *** [rapid/plugin/group_replication/CMakeFiles/gr_unit_test_resource.dir/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    [ 10%] Building CXX object extra/protobuf/CMakeFiles/protobuf-lite.dir/protobuf-2.6.1/src/google/protobuf/stubs/common.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protobuf-lite.dir/protobuf-2.6.1/src/google/protobuf/stubs/once.cc.o
    [ 11%] [ 11%] Building CXX object extra/protobuf/CMakeFiles/protobuf-lite.dir/protobuf-2.6.1/src/google/protobuf/stubs/stringprintf.cc.o
    Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/command_line_interface.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protobuf-lite.dir/protobuf-2.6.1/src/google/protobuf/extension_set.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protobuf-lite.dir/protobuf-2.6.1/src/google/protobuf/generated_message_util.cc.o
    [ 11%] [ 11%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/stubs/substitute.cc.o
    Building CXX object extra/protobuf/CMakeFiles/protobuf-lite.dir/protobuf-2.6.1/src/google/protobuf/message_lite.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/stubs/structurally_valid.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protobuf-lite.dir/protobuf-2.6.1/src/google/protobuf/repeated_field.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/descriptor.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protobuf-lite.dir/protobuf-2.6.1/src/google/protobuf/wire_format_lite.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protobuf-lite.dir/protobuf-2.6.1/src/google/protobuf/io/coded_stream.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protobuf-lite.dir/protobuf-2.6.1/src/google/protobuf/io/zero_copy_stream.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protobuf-lite.dir/protobuf-2.6.1/src/google/protobuf/io/zero_copy_stream_impl_lite.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/descriptor.pb.cc.o
    Linking CXX static library libprotobuf-lite.a
    [ 11%] Built target protobuf-lite
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/descriptor_database.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/plugin.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/plugin.pb.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/dynamic_message.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/subprocess.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/zip_writer.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/extension_set_heavy.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/cpp/cpp_enum.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/generated_message_reflection.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/cpp/cpp_enum_field.cc.o
    [ 11%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/message.cc.o
    [ 12%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/cpp/cpp_extension.cc.o
      [ 12%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/reflection_ops.cc.o
      [ 12%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/service.cc.o
        [ 12%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/text_format.cc.o 
         [ 12%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/unknown_field_set.cc.o
    [ 12%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/wire_format.cc.o
    [ 12%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/io/gzip_stream.cc.o
    [ 12%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/cpp/cpp_field.cc.o
    [ 12%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/io/printer.cc.o
    [ 12%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/io/strtod.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/io/tokenizer.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/io/zero_copy_stream_impl.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/cpp/cpp_file.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/compiler/importer.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/compiler/parser.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/cpp/cpp_generator.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/stubs/common.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/stubs/once.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/cpp/cpp_helpers.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/stubs/stringprintf.cc.o
    [ 13%] [ 13%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/cpp/cpp_message.cc.o
    Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/extension_set.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/generated_message_util.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/message_lite.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/cpp/cpp_message_field.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/repeated_field.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/wire_format_lite.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/io/coded_stream.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/io/zero_copy_stream.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protobuf.dir/protobuf-2.6.1/src/google/protobuf/io/zero_copy_stream_impl_lite.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/cpp/cpp_service.cc.o
    Linking CXX static library libprotobuf.a
    [ 13%] Built target protobuf
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/cpp/cpp_string_field.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/java/java_context.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/java/java_enum.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/java/java_enum_field.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/java/java_extension.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/java/java_field.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/java/java_file.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/java/java_generator.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/java/
    java_generator_factory.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/java/java_helpers.cc.o
    [ 13%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/java/
    java_lazy_message_field.cc.o
    [ 14%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/java/java_message.cc.o
    [ 14%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/java/java_message_field.cc.o
    [ 14%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/java/java_name_resolver.cc.o
    [ 14%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/java/
    java_primitive_field.cc.o
    [ 14%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/java/
    java_shared_code_generator.cc.o
    [ 14%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/java/java_service.cc.o    
      [ 14%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/java/java_string_field.cc.o
    [ 14%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/java/java_doc_comment.cc.o
    [ 14%] Building CXX object extra/protobuf/CMakeFiles/protoclib.dir/protobuf-2.6.1/src/google/protobuf/compiler/python/python_generator.cc.o
    Linking CXX static library libprotoclib.a
    [ 14%] Built target protoclib
    make: *** [all] Error 2
    **报错原因:cmake 版本太低** 
  [root@CentOS73-1 cmake-3.9.1]# ./configure
    [root@CentOS73-1 cmake-3.9.1]# make
    [root@CentOS73-1 cmake-3.9.1]# make install
    [root@CentOS73-1 ~]# cd /usr/local/src/mysql-5.7.19/
    [root@CentOS73-1 mysql-5.7.19]# rm -rf CMakeCache.txt
    退出终端,重进
    重新 cmake , make ,make install
    cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
    -DSYSCONFDIR=/etc \
    -DMYSQL_TCP_PORT=3306 \
    -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
    -DDEFAULT_CHARSET=utf8 \
    -DMYSQL_DATADIR=/usr/local/mysql/data \
    -DENABLED_LOCAL_INFILE=1 \
    -DEXTRA_CHARSETS=all \
    -DDEFAULT_COLLATION=utf8_general_ci \
    -DWITH_BOOST=/usr/local/src/boost_1_59_0        
  [ 78%] Building CXX object rapid/plugin/x/CMakeFiles/mysqlx.dir/generated/protobuf_lite/mysqlx_resultset.pb.cc.o
    [ 78%] Building CXX object libmysqld/CMakeFiles/sql_embedded.dir/__/sql/item_geofunc_buffer.cc.o
    [ 78%] Building CXX object libmysqld/CMakeFiles/sql_embedded.dir/__/sql/item_geofunc_internal.cc.o
    [ 78%] Linking CXX shared module mysqlx.so
    [ 79%] Built target mysqlx
    [ 79%] Building CXX object libmysqld/CMakeFiles/sql_embedded.dir/__/sql/item_geofunc_relchecks.cc.o
    c++: internal compiler error: Killed (program cc1plus)
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <http://bugzilla.redhat.com/bugzilla> for instructions. 
    make[2]: *** [libmysqld/CMakeFiles/sql_embedded.dir/__/sql/item_geofunc.cc.o] Error 4
    make[2]: *** Waiting for unfinished jobs....
    make[1]: *** [libmysqld/CMakeFiles/sql_embedded.dir/all] Error 2
    make: *** [all] Error 2
    **错误原因:内存不不够 make -j4 启动 4 个gcc 进程耗费内存过⼤大**    
 背景:⽤用阿⾥里里云编译mysql5.7.12时在编译⼀一半时出现错误,如下:
    [ 50%] Building CXX object sql/CMakeFiles/sql.dir/item_cmpfunc.cc.o
    [ 50%] Building CXX object sql/CMakeFiles/sql.dir/item_create.cc.o
    [ 50%] Building CXX object sql/CMakeFiles/sql.dir/item_func.cc.o
    [ 50%] Building CXX object sql/CMakeFiles/sql.dir/item_geofunc.cc.o
    c++: 编译器器内部错误:已杀死(程序 cc1plus)
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <http://bugzilla.redhat.com/bugzilla> for instructions.
    make[2]: *** [sql/CMakeFiles/sql.dir/item_geofunc.cc.o] 错误 4
    make[1]: *** [sql/CMakeFiles/sql.dir/all] 错误 2
    make: *** [all] 错误 2
    不不要感觉奇怪,其实是内存不不够导致的,这位兄弟也遇到⼀一样的问题,如下:
    在这⾥里里特别提醒, 对于mysql5.7.8的make编译, 如果是阿⾥里里云centos主机512M内存的, 会在make编译到45%时会报错, 这是内存不不⾜足所致。
    c++: Internal error: Killed (program cc1plus)
    Please submit a full bug report.
    See <http://bugzilla.redhat.com/bugzilla> for instructions.
    make[2]: *** [sql/CMakeFiles/sql.dir/item_geofunc.cc.o] Error 1
    make[1]: *** [sql/CMakeFiles/sql.dir/all] Error 2
    make: *** [all] Error 2
    那么设置2G交换分区来⽤用下 :
    # dd if=/dev/zero of=/swapfile bs=1k count=2048000 --获取要增加的2G的SWAP⽂文件块
    # mkswap /swapfile -- 创建SWAP⽂文件
    # swapon /swapfile -- 激活SWAP⽂文件
    # swapon -s -- 查看SWAP信息是否正确
    # echo "/var/swapfile swap swap defaults 0 0" >> /etc/fstab -- 添加到fstab⽂文件中让系统引导时⾃自动启动
     注意, swapfile⽂文件的路路径在/var/下
    编译完后, 如果不不想要交换分区了了, 可以删除:
    # swapoff /swapfile
    # rm -fr /swapfile     
初始化报错 
mysql_install_db 命令已经不不赞成使⽤用,需要使⽤用 mysqld 命令初始化数据库⽬目录

    [root@centos74-0 mysql-5.7.19]# ./bin/mysql_install_db --user=mysql
    2017-11-18 14:57:04 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
    2017-11-18 14:57:04 [ERROR] The data directory needs to be specified.
[root@centos74-0 mysql-5.7.19]# ./bin/mysqld --initialize

    2017-11-18T06:57:28.845607Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --
    explicit_defaults_for_timestamp server option (see documentation for more details).
    2017-11-18T06:57:29.129344Z 0 [Warning] InnoDB: New log files created, LSN=45790
    2017-11-18T06:57:29.203844Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
    2017-11-18T06:57:29.263076Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this
    server has been started. Generating a new UUID: be136ee3-cc2d-11e7-b4a7-001c42ebb70f.
    2017-11-18T06:57:29.264361Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
    2017-11-18T06:57:29.265114Z 1 [Note] A temporary password is generated for root@localhost: xkkJiMlmX3&s
[root@centos74-0 mysql-5.7.19]# ll -d data

drwxr-x--- 5 root root 147 Nov 18 14:57 data
[root@centos74-0 bin]# ./mysqld --initialize --user=mysql

    2017-11-18T07:20:37.761916Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --
    explicit_defaults_for_timestamp server option (see documentation for more details).
    2017-11-18T07:20:38.007055Z 0 [Warning] InnoDB: New log files created, LSN=45790
    2017-11-18T07:20:38.055215Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
    2017-11-18T07:20:38.112842Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this
    server has been started. Generating a new UUID: f9e51e81-cc30-11e7-b3f5-001c42ebb70f.
    2017-11-18T07:20:38.114500Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
    2017-11-18T07:20:38.115271Z 1 [Note] A temporary password is generated for root@localhost: I<XPKquuk0:u
[root@centos74-0 bin]# ./mysqld_safe --user=mysql

      Logging to '/usr/local/mysql-5.7.20/data/centos74-0.err'. 
      2017-11-18T07:21:14.070919Z mysqld_safe Starting mysqld daemon         
    with databases from /usr/local/mysql-5.7.20/data
[root@centos74-0 mysql-5.7.20]# ./bin/mysql -uroot -p'I<XPKquuk0:u'

    mysql: [Warning] Using a password on the command line interface can be insecure.
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 3
    Server version: 5.7.20
    Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql>      
如果数据⽬目录⾮非空,会认为数据库已存在,⽆无法初始化

    [root@localhost mysql]# ./bin/mysqld --initialize --user=mysql
    2017-11-18T07:25:50.083462Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp
    server option (see documentation for more details).
    2017-11-18T07:25:50.088292Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
    2017-11-18T07:25:50.088372Z 0 [ERROR] Aborting     
    
发布了44 篇原创文章 · 获赞 1 · 访问量 4339

猜你喜欢

转载自blog.csdn.net/zc520yzy/article/details/102837352
今日推荐