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.加入守护进程
cd /usr/local/mysql
cp support-files/mysql.server /etc/init.d/mysqld
chmod a+x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --list mysqld
chkconfig mysqld on
7.初始化数据库, –initialize 表示默认生成一个安全的密码,–initialize-insecure 表示不生成密码
mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/3306/
2019-07-15T03:46:38.859798Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-07-15T03:46:39.250281Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-07-15T03:46:39.410341Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-07-15T03:46:39.483526Z 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: 26fabfb6-a6b3-11e9-8f70-fa163efdf571.
2019-07-15T03:46:39.485233Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed‘ cannot be opened.
2019-07-15T03:46:39.486976Z 1 [Warning] [email protected] is created with an empty password ! Please consider switching off the --initialize-insecure option.

8.启动服务
service mysqld start
Starting MySQL.Logging to ‘/data/mysql/3306/mysqld.log‘.
SUCCESS!
9.第一次登陆不需要密码,回车即可
mysql -u root -p
set password for [email protected] = password(‘root‘); #修改密码

10.gdb
cat debug.file
break main #打断点
run --defaults-file=/etc/my.cnf --user=mysql --gdb #调试
chown mysql.mysql debug.file
11.启动调试环境

        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) 

原文地址:https://blog.51cto.com/3204960/2420315

时间: 2024-10-07 21:11:37

MySQL5.7.26 源码编译安装的相关文章

烂泥:mysql5.0数据库源码编译安装

本文首发于烂泥行天下. 本次实验的mysql.OS相关信息如下: Mysql:5.0.96 OS:centos 32 bit 最近公司要上新的业务,指明数据库使用的是mysql5.0版本.如果是使用rpm包安装的话,那就很简单了.直接使用yum安装即可,命令如下: yum –y install mysql mysql-server Yum方式安装完毕后,直接启动mysql数据库服务即可.如下图: 这样基本上就可以了. 但是这样安装mysql数据库,没有进行定制.比如mysql数据库的数据文件存储

mysql5.7.11 源码编译安装 (Red hat linux 6.5 )

mysql5.7.11 源码编译安装 (Red hat linux 6.5 ) 一.准备工作 1.1 卸载系统自带mysql 查看系统是否自带mysql, 如果有就卸载了, 卸载方式有两种yum, rpm, 这里通过yum卸载 rpm -qa | grep mysql    //查看系统自带mysql yum -y remove mysql-*   //卸载mysql rpm -e –nodeps mysql-5.1.73-3.el6_5.x86_64 //卸载mysql 1.2 卸载系统自带b

多实例Mysql5.5.x源码编译安装

多实例Mysql5.5.x源码编译安装 1.  建立Mysql账号 [[email protected] ~]# groupadd mysql [[email protected] ~]# useradd -s /sbin/nologin -g mysql -M mysql useradd参数说明: -s/sbin/nologin 表示禁止该用户登录 -gmysql 指定属于mysql组 -M表示不创建用户家目录 检查创建的用户: [[email protected] ~]# tail -1 /

mysql5.7.10 源码编译安装记录 (centos6.4)【转】

一.准备工作 1.1 卸载系统自带mysql 查看系统是否自带MySQL, 如果有就卸载了, 卸载方式有两种yum, rpm, 这里通过yum卸载 rpm -qa | grep mysql //查看系统自带mysql yum -y remove mysql-* //卸载mysql rpm -e --nodeps mysql-5.1.73-3.el6_5.x86_64 //卸载mysql 1.2 卸载系统自带boost,并安装boost_1_59_0 mysql 5.7 依赖于boost_1_59

mysql-5.7.23源码编译安装

mysql-5.7.23源码编译安装 1.下载源码 # wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.23.tar.gz # tar xf mysql-5.7.23.tar.gz 2.隐藏版本信息 隐藏版本信息是XX电信运营商提出的变态要求,经测试版本信息不能直接删除,否则编译出错,暂时修改为100.100.100 # cd mysql-5.7.23 # vim VERSION MYSQL_VERSION_MAJOR=100

mysql-5.5.46源码编译安装

1.安装准备 cat /etc/redhat-release uname -r yum install ncurses-devel cmake automake autoconf make gcc gcc-c++ bison -y mkdir /application/data -p groupadd mysql useradd -g mysql  -s  /sbin/nologin -M mysql 2.源码安装 cd  tools tar xf mysql-5.5.46.tar.gz cma

【Linux】Mysql5.7.12源码编译安装及配置

安装环境 Linux(CentOS7.0 版).boost_1_59_0.tar.gz.mysql-5.7.12.tar.gz MySQL 5.7主要特性: 更好的性能:对于多核CPU.固态硬盘.锁有着更好的优化,每秒100W QPS已不再是MySQL的追求,下个版本能否上200W QPS才是吾等用户更关心的 更好的InnoDB存储引擎 更为健壮的复制功能:复制带来了数据完全不丢失的方案,传统金融客户也可以选择使用MySQL数据库.此外,GTID在线平滑升级也变得可能 更好的优化器:优化器代码重

CentOS 6.4 64位平台mysql5.5.36源码编译安装

目录 1.系统环境 2.准备用户及数据存储目录 3.编译安装mysql 4.mysql数据库的初始安全配置 5.mysql管理员密码丢失的处理 1.系统环境 [[email protected]_server ~]# cat /etc/issue CentOS release 6.4 (Final) Kernel \r on an \m [[email protected]_server ~]# uname -r 2.6.32-358.el6.x86_64 在安装系统时已安装过"Developm

mysql5.7.22源码编译安装

mkdir /tools && cd /tools mysql下载https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.22.tar.gz 下载boost源码https://jaist.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz groupadd mysql useradd -s /sbin/nologin -M -g mysql mysql y