MySQL5.7.26 源码编译设置:

  1.安装依赖组件
  yum -y install gcc gcc-c++ pcre pcre-devel openssl openssl-devel
  yum -y install zlib zlib-devel cmake ncurses ncurses-devel bison bison-devel
  如下的几个依赖在CentOS7中需要安装,CentOS6不需要
  yum -y install perl perl-devel autoconf
 
  2.下载解压源码包(包括boost)
  tar xzf mysql-boost-5.7.26.tar.gz
 
  3.第一次安装需要添加MySQL用户
  useradd -s /sbin/nologin -M mysql
 
  4.从MySQL 5.7.5开始Boost库是必需的,编译比较耗内存和时间,内存要求至少一个G
  cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
  -DMYSQL_DATADIR=/data/mysql/3306 \
  -DSYSCONFDIR=/etc \
  -DWITH_INNOBASE_STORAGE_ENGINE=1 \
  -DWITH_PARTITION_STORAGE_ENGINE=1 \
  -DWITH_FEDERATED_STORAGE_ENGINE=1 \
  -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
  -DWITH_MYISAM_STORAGE_ENGINE=1 \
  -DWITH_ARCHIVE_STORAGE_ENGINE=1 \
  -DMYSQL_UNIX_ADDR=/tmp/mysql3306.sock \
  -DMYSQL_TCP_PORT=3306 \
  -DENABLED_LOCAL_INFILE=1 \
  -DEXTRA_CHARSETS=all \
  -DDEFAULT_CHARSET=utf8mb4 \
  -DDEFAULT_COLLATION=utf8mb4_general_ci \
  -DMYSQL_USER=mysql \
  -DWITH_BINLOG_PREALLOC=ON \
  -DWITH_BOOST=boost \
  -DWITH_DEBUG=1
 
  make && make install
  [ 24%] Building CXX object storage/innobase/CMakeFiles/innobase.dir/row/row0log.cc.o
  [ 24%] Building CXX object storage/innobase/CMakeFiles/innobase.dir/row/row0purge.cc.o
  [ 24%] Building CXX object storage/innobase/CMakeFiles/innobase.dir/row/row0row.cc.o
  [ 24%] Building CXX object storage/innobase/CMakeFiles/innobase.dir/row/row0sel.cc.o
  [ 24%] Building CXX object storage/innobase/CMakeFiles/innobase.dir/row/row0trunc.cc.o
  [ 24%] Building CXX object storage/innobase/CMakeFiles/innobase.dir/row/row0uins.cc.o
  [ 24%] Building CXX object storage/innobase/CMakeFiles/innobase.dir/row/row0umod.cc.o
  [ 24%] Building CXX object storage/innobase/CMakeFiles/innobase.dir/row/row0undo.cc.o
  [ 24%] Building CXX object storage/innobase/CMakeFiles/innobase.dir/row/row0upd.cc.o
  [ 24%] Building CXX object storage/innobase/CMakeFiles/innobase.dir/row/row0quiesce.cc.o
 
  5.创建简易 /etc/my.cnf 后续补充
  [client]
  no-auto-rehash
  default-character-set=utf8mb4
  #password = your_password
  port = 3306
  socket = /tmp/mysql3306.sock
 
      [mysqld]
      character-set-server=utf8mb4
      collation-server=utf8mb4_general_ci
      basedir=/usr/local/mysql/
      datadir=/data/mysql/3306/
      socket=/tmp/mysql3306.sock
 
      server-id = 1102200
      log-bin=mysql_binlog
      binlog_format=row
      log_slave_updates = 1
 
      skip_name_resolve = ON
      innodb_file_per_table = ON
      lower_case_table_names=1
      max_allowed_packet = 1M
      table_open_cache = 512
      sort_buffer_size = 2M
      read_buffer_size = 2M
      read_rnd_buffer_size = 8M
 
      [mysqld_safe]
      log-error=/data/mysql/3306/mysqld.log
      pid-file=/data/mysql/3306/mysqld.pid
 
      [mysqldump]
      quick
      max_allowed_packet = 16M
 
      [mysqlhotcopy]
      interactive-timeout
  6.启动调试环境
 
          gdb -x /data/mysql/3306/debug.file /usr/local/mysql/bin/mysqld
               GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-110.el7
               Copyright (C) 2013 Free Software Foundation, Inc.
               License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
               This is free software: you are free to change and redistribute it.
               There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
               and "show warranty" for details.
               This GDB was configured as "x86_64-redhat-linux-gnu".
               For bug reporting instructions, please see:
               <http://www.gnu.org/software/gdb/bugs/>...
               Reading symbols from /usr/local/mysql/bin/mysqld...done.
               Breakpoint 1 at 0xea031c: file /usr/local/mysql-5.7.26/sql/main.cc, line 25.
               [Thread debugging using libthread_db enabled]
               Using host libthread_db library "/lib64/libthread_db.so.1".
 
               Breakpoint 1, main (argc=4, argv=0x7fffffffe538) at /usr/local/mysql-5.7.26/sql/main.cc:25
               25   return mysqld_main(argc, argv);
               Missing separate debuginfos, use: debuginfo-install glibc-2.17-222.el7.x86_64 libgcc-4.8.5-28.el7_5.1.x86_64 libstdc++-4.8.5-28.el7_5.1.x86_64 nss-softokn-freebl-3.34.0-2.el7.x86_64
               (gdb) 

dawei

【声明】:站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。