Focus On Oracle

Installing, Backup & Recovery, Performance Tuning,
Troubleshooting, Upgrading, Patching

Oracle Engineered System


当前位置: 首页 » 技术文章 » MySQL

Build Mysql Debug Release from Source Code 5.7.15

MySQL是一个关系型数据库管理系统,由瑞典MySQL AB 公司开发,目前属于Oracle旗下产品。MySQL在WEB应用方面MySQL是最好的关系数据库管理系统应用软件之一。MySQL所使用的SQL语言是用于访问数据库的最常用标准化语言。MySQL软件采用了双授权政策,它分为社区版和商业版,由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点,一般中小型网站的开发都选择 MySQL 作为网站数据库。



首先我们需要从官网上下载mysql源码,然后尝试编译为Debug版本。可以更多的了解编译过程,进而可以更好的让我们理解MySQL。

登录http://dev.mysql.com/downloads/mysql/


下载Generic Linux (Architecture Independent), Compressed TAR Archive Includes Boost Headers

http://dev.mysql.com/downloads/file/?id=465370



安装需要的包和编译器

yum install ncurses ncurses-devel
yum install cmake
yum groupinstall "Development Tools"
[root@ohs2 opt]# yum install ncurses ncurses-devel
Loaded plugins: refresh-packagekit, security, ulninfo
Setting up Install Process
Package ncurses-5.7-4.20090207.el6.x86_64 already installed and latest version
Package ncurses-devel-5.7-4.20090207.el6.x86_64 already installed and latest version
Nothing to do
[root@ohs2 opt]# yum install cmake
Loaded plugins: refresh-packagekit, security, ulninfo
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package cmake.x86_64 0:2.8.12.2-4.el6 will be installed
--> Finished Dependency Resolution
Warning: RPMDB altered outside of yum.
Installed:cmake.x86_64 2.8.12.2-4.el6                                                                                                                           
Complete!
[root@ohs2 opt]# yum groupinstall "Development Tools"
Loaded plugins: refresh-packagekit, security, ulninfo
Setting up Group Process
Package flex-2.5.35-9.el6.x86_64 already installed and latest version
Package gcc-4.4.7-17.el6.x86_64 already installed and latest version
Package redhat-rpm-config-9.0.3-51.0.1.el6.noarch already installed and latest version
Package rpm-build-4.8.0-55.el6.x86_64 already installed and latest version
Package 1:make-3.81-23.el6.x86_64 already installed and latest version
Package patch-2.6-6.el6.x86_64 already installed and latest version
Package 1:pkgconfig-0.23-9.1.el6.x86_64 already installed and latest version
Package gettext-0.17-18.el6.x86_64 already installed and latest version
Package automake-1.11.1-4.el6.noarch already installed and latest version
Package bison-2.4.1-5.el6.x86_64 already installed and latest version
Package libtool-2.2.6-15.5.el6.x86_64 already installed and latest version
Package autoconf-2.63-5.1.el6.noarch already installed and latest version
Package gcc-c++-4.4.7-17.el6.x86_64 already installed and latest version
Package binutils-2.20.51.0.2-5.44.el6.x86_64 already installed and latest version
Package patchutils-0.3.1-3.1.el6.x86_64 already installed and latest version
Package byacc-1.9.20070509-7.el6.x86_64 already installed and latest version
Package indent-2.2.10-7.el6.x86_64 already installed and latest version
Package systemtap-2.9-4.0.1.el6.x86_64 already installed and latest version
Package diffstat-1.51-2.el6.x86_64 already installed and latest version
Package elfutils-0.164-2.el6.x86_64 already installed and latest version
Package cvs-1.11.23-16.el6.x86_64 already installed and latest version
Package rcs-5.7-37.el6.x86_64 already installed and latest version
Package subversion-1.6.11-15.el6_7.x86_64 already installed and latest version
Package gcc-gfortran-4.4.7-17.el6.x86_64 already installed and latest version
Package 1:doxygen-1.6.1-6.el6.x86_64 already installed and latest version
Package intltool-0.41.0-1.1.el6.noarch already installed and latest version
Package git-1.7.1-4.el6_7.1.x86_64 already installed and latest version
Package ctags-5.8-2.el6.x86_64 already installed and latest version
Package cscope-15.6-7.el6.x86_64 already installed and latest version
Package swig-1.3.40-6.el6.x86_64 already installed and latest version
Warning: Group development does not have any packages.
No packages in any requested group available to install or update
[root@ohs2 opt]# 

查看编译器版本
[root@ohs2 opt]# cmake -version
cmake version 2.8.12.2
[root@ohs2 opt]# make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-redhat-linux-gnu
[root@ohs2 opt]# gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@ohs2 opt]# 

Preconfiguration setup

[root@ohs2 opt]# which mysql
/usr/bin/mysql
[root@ohs2 opt]#
移除默认安装的mysql包
[root@ohs2 ~]# rpm -qa|grep mysql
mysql-5.1.73-7.el6.x86_64
mysql-devel-5.1.73-7.el6.x86_64
mysql-libs-5.1.73-7.el6.x86_64
mysql-server-5.1.73-7.el6.x86_64
mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
[root@ohs2 ~]# rpm -e --nodeps mysql-5.1.73-7.el6.x86_64
[root@ohs2 ~]# rpm -e --nodeps mysql-devel-5.1.73-7.el6.x86_64
[root@ohs2 ~]# rpm -e --nodeps mysql-libs-5.1.73-7.el6.x86_64
[root@ohs2 ~]# rpm -e --nodeps mysql-server-5.1.73-7.el6.x86_64
[root@ohs2 ~]# rpm -e --nodeps mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
[root@ohs2 ~]# rpm -qa|grep mysql
[root@ohs2 ~]# rm -fr /usr/lib/mysql
[root@ohs2 ~]# rm -fr /usr/include/mysql
[root@ohs2 ~]# rm -f /etc/my.cnf
[root@ohs2 ~]# rm -fr /var/lib/mysql
[root@ohs2 ~]#
[root@ohs2 ~]# groupadd mysql
[root@ohs2 ~]# useradd -r -g mysql -s /bin/false mysql
[root@ohs2 ~]# 

Beginning of source-build specific instructions
[root@ohs2 ~]# cd /opt/
[root@ohs2 opt]# cmake -E tar zxvf mysql-boost-5.7.15.tar.gz 三个解压命令都可以
                             tar zxvf mysql-boost-5.7.15.tar.gz
                             gunzip < mysql-boost-5.7.15.tar.gz | tar xvf -
[root@ohs2 opt]# cd mysql-5.7.15/
[root@ohs2 mysql-5.7.15]# cmake -DWITH_DEBUG=1 -DWITH_BOOST=/opt/mysql-5.7.15/boost/boost_1_59_0
-- Running cmake version 2.8.12.2
-- Found Git: /usr/bin/git (found version "1.7.1")
-- Configuring with MAX_INDEXES = 64U
-- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for SHM_HUGETLB
-- Looking for SHM_HUGETLB - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void *
-- Check size of void * - done
-- SIZEOF_VOIDP 8
-- Performing Test HAVE_C_FLOATING_POINT_OPTIMIZATION_PROBLEMS
-- Performing Test HAVE_C_FLOATING_POINT_OPTIMIZATION_PROBLEMS - Failed
-- Performing Test HAVE_CXX_FLOATING_POINT_OPTIMIZATION_PROBLEMS
-- Performing Test HAVE_CXX_FLOATING_POINT_OPTIMIZATION_PROBLEMS - Failed
-- MySQL 5.7.15
-- Packaging as: mysql-5.7.15-Linux-x86_64
-- Local boost dir /opt/mysql-5.7.15/boost/boost_1_59_0
-- Found /opt/mysql-5.7.15/boost/boost_1_59_0/boost/version.hpp
-- BOOST_VERSION_NUMBER is #define BOOST_VERSION 105900
-- BOOST_INCLUDE_DIR /opt/mysql-5.7.15/boost/boost_1_59_0
-- Performing Test HAVE_LLVM_LIBCPP
-- Performing Test HAVE_LLVM_LIBCPP - Failed
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Looking for floor
-- Looking for floor - not found
-- Looking for floor in m
-- Looking for floor in m - found
-- Looking for gethostbyname_r
-- Looking for gethostbyname_r - found
-- Looking for bind
-- Looking for bind - found
-- Looking for crypt
-- Looking for crypt - not found
-- Looking for crypt in crypt
-- Looking for crypt in crypt - found
-- Looking for setsockopt
-- Looking for setsockopt - found  -- Looking for include files curses.h, term.h
-- Looking for include files curses.h, term.h - found
-- Looking for include file termios.h
-- Looking for include file termios.h - found
-- Looking for include file termio.h
-- Looking for include file termio.h - found
-- Looking for include file unistd.h
-- Looking for include file unistd.h - found
-- Looking for include file sys/wait.h
-- Looking for include file sys/wait.h - found
-- Looking for include file sys/param.h
-- Looking for include file sys/param.h - found
-- Looking for include file fnmatch.h
-- Looking for include file fnmatch.h - found
-- Looking for include file sys/un.h
-- Looking for include file sys/un.h - found
-- Looking for include file vis.h
-- Looking for include file vis.h - not found
-- Looking for include file sasl/sasl.h
-- Looking for include file sasl/sasl.h - found
-- Looking for include file sys/devpoll.h
-- Looking for include file sys/devpoll.h - not found
-- Looking for include file sys/epoll.h
-- Looking for include file sys/epoll.h - found
-- Looking for TAILQ_FOREACH
-- Looking for TAILQ_FOREACH - found
-- Looking for _aligned_malloc
-- Looking for _aligned_malloc - not found
-- Looking for backtrace
-- Looking for backtrace - found
-- Looking for printstack
-- Looking for printstack - not found
-- Looking for index
-- Looking for index - found
-- Looking for clock_gettime
-- Looking for clock_gettime - found
-- Looking for cuserid
-- Looking for cuserid - found
-- Looking for directio
-- Looking for directio - not found
-- Looking for ftruncate
-- Looking for ftruncate - found
-- Looking for compress
-- Looking for compress - not found
-- Looking for crypt
-- Looking for crypt - found
-- Looking for dlopen
-- Looking for dlopen - found
-- Looking for fchmod
-- Looking for fchmod - found
-- Looking for fcntl
-- Looking for fcntl - found
-- Looking for fdatasync
-- Looking for fdatasync - found
-- Looking for fdatasync
-- Looking for fdatasync - found
-- Looking for fedisableexcept
-- Looking for fedisableexcept - found
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for fsync
-- Looking for fsync - found
-- Looking for gethostbyaddr_r
-- Looking for gethostbyaddr_r - found
-- Looking for gethrtime
-- Looking for gethrtime - not found
-- Looking for getnameinfo
-- Looking for getnameinfo - found
-- Looking for getpass
-- Looking for getpass - found
-- Looking for getpassphrase
-- Looking for getpassphrase - not found
-- Looking for getpwnam
-- Looking for getpwnam - found
-- Looking for getpwuid
-- Looking for getpwuid - found
-- Looking for getrlimit
-- Looking for getrlimit - found
-- Looking for getrusage
-- Looking for getrusage - found
-- Looking for initgroups
-- Looking for initgroups - found
-- Looking for issetugid
-- Looking for issetugid - not found
-- Looking for getuid
-- Looking for getuid - found
-- Looking for geteuid
-- Looking for geteuid - found
-- Looking for getgid
-- Looking for getgid - found
-- Looking for getegid
-- Looking for getegid - found
-- Looking for lstat
-- Looking for lstat - found
-- Looking for madvise
-- Looking for madvise - found
-- Looking for malloc_info
-- Looking for malloc_info - found
-- Looking for memrchr
-- Looking for memrchr - found
-- Looking for mlock
-- Looking for mlock - found
-- Looking for mlockall
-- Looking for mlockall - found
-- Looking for mmap64
-- Looking for mmap64 - found
-- Looking for poll
-- Looking for poll - found
-- Looking for posix_fallocate
-- Looking for posix_fallocate - found
-- Looking for posix_memalign
-- Looking for posix_memalign - found
-- Looking for pread
-- Looking for pread - found
-- Looking for pthread_condattr_setclock
-- Looking for pthread_condattr_setclock - found
-- Looking for pthread_sigmask
-- Looking for pthread_sigmask - found
-- Looking for readdir_r
-- Looking for readdir_r - found
-- Looking for readlink
-- Looking for readlink - found
-- Looking for realpath
-- Looking for realpath - found
-- Looking for setfd
-- Looking for setfd - not found
-- Looking for sigaction
-- Looking for sigaction - found
-- Looking for sleep
-- Looking for sleep - found
-- Looking for stpcpy
-- Looking for stpcpy - found
-- Looking for stpncpy
-- Looking for stpncpy - found
-- Looking for strlcpy
-- Looking for strlcpy - not found
-- Looking for strndup
-- Looking for strndup - found
-- Looking for strnlen
-- Looking for strnlen - found
-- Looking for strlcat
-- Looking for strlcat - not found
-- Looking for strsignal
-- Looking for strsignal - found
-- Looking for fgetln
-- Looking for fgetln - not found
-- Looking for strsep
-- Looking for strsep - found
-- Looking for tell
-- Looking for tell - not found
-- Looking for vasprintf
-- Looking for vasprintf - found
-- Looking for memalign
-- Looking for memalign - found
-- Looking for nl_langinfo
-- Looking for nl_langinfo - found
-- Looking for ntohll
-- Looking for ntohll - not found
-- Looking for clock_gettime
-- Looking for clock_gettime - found
-- Looking for epoll_create
-- Looking for epoll_create - found
-- Looking for inet_ntop
-- Looking for inet_ntop - found
-- Looking for kqueue
-- Looking for kqueue - not found
-- Looking for timeradd
-- Looking for timeradd - found
-- Looking for timerclear
-- Looking for timerclear - found
-- Looking for timercmp
-- Looking for timercmp - found
-- Looking for timerisset
-- Looking for timerisset - found
-- Looking for include file sys/time.h
-- Looking for include file sys/time.h - found
-- Looking for include file sys/times.h
-- Looking for include file sys/times.h - found
-- Looking for times
-- Looking for times - found
-- Looking for gettimeofday
-- Looking for gettimeofday - found
-- Looking for lrand48
-- Looking for lrand48 - found
-- Looking for TIOCGWINSZ
-- Looking for TIOCGWINSZ - found
-- Looking for FIONREAD
-- Looking for FIONREAD - found
-- Looking for FIONREAD
-- Looking for FIONREAD - not found
-- Looking for SIGEV_THREAD_ID
-- Looking for SIGEV_THREAD_ID - found
-- Looking for SIGEV_PORT
-- Looking for SIGEV_PORT - not found
-- Looking for log2
-- Looking for log2 - found
-- Looking for isinf
-- Looking for isinf - found
-- Performing Test HAVE_CXX_ISINF
-- Performing Test HAVE_CXX_ISINF - Success
-- Looking for timer_create
-- Looking for timer_create - found
-- Looking for timer_settime
-- Looking for timer_settime - found
-- Looking for kqueue
-- Looking for kqueue - not found
-- Looking for EVFILT_TIMER
-- Looking for EVFILT_TIMER - not found
-- Check if the system is big endian
-- Searching 16 bit integer
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Check size of char *
-- Check size of char * - done
-- Check size of long
-- Check size of long - done
-- Check size of short
-- Check size of short - done
-- Check size of int
-- Check size of int - done
-- Check size of long long
-- Check size of long long - done
-- Check size of off_t
-- Check size of off_t - done
-- Check size of time_t
-- Check size of time_t - done
-- Check size of struct timespec
-- Check size of struct timespec - done
-- Check size of uint
-- Check size of uint - done
-- Check size of ulong
-- Check size of ulong - done
-- Check size of u_int32_t
-- Check size of u_int32_t - done
-- Performing Test HAVE_VISIBILITY_HIDDEN
-- Performing Test HAVE_VISIBILITY_HIDDEN - Success
-- Checking stack direction : -1
-- Looking for include files time.h, sys/time.h
-- Looking for include files time.h, sys/time.h - found
-- Looking for O_NONBLOCK
-- Looking for O_NONBLOCK - found
-- Performing Test HAVE_PAUSE_INSTRUCTION
-- Performing Test HAVE_PAUSE_INSTRUCTION - Success
-- Performing Test HAVE_BSS_START
-- Performing Test HAVE_BSS_START - Success
-- Performing Test HAVE_BUILTIN_UNREACHABLE
-- Performing Test HAVE_BUILTIN_UNREACHABLE - Success
-- Performing Test HAVE_BUILTIN_EXPECT
-- Performing Test HAVE_BUILTIN_EXPECT - Success
-- Performing Test HAVE_BUILTIN_STPCPY
-- Performing Test HAVE_BUILTIN_STPCPY - Success
-- Performing Test HAVE_GCC_ATOMIC_BUILTINS
-- Performing Test HAVE_GCC_ATOMIC_BUILTINS - Failed
-- Performing Test HAVE_GCC_SYNC_BUILTINS
-- Performing Test HAVE_GCC_SYNC_BUILTINS - Success
-- Looking for netinet/in6.h
-- Looking for netinet/in6.h - not found
-- Check size of struct sockaddr_in6
-- Check size of struct sockaddr_in6 - done
-- Check size of struct in6_addr
-- Check size of struct in6_addr - done
-- Performing Test HAVE_SOCKADDR_STORAGE_SS_FAMILY
-- Performing Test HAVE_SOCKADDR_STORAGE_SS_FAMILY - Success
-- Performing Test HAVE_SOCKADDR_IN_SIN_LEN
-- Performing Test HAVE_SOCKADDR_IN_SIN_LEN - Failed
-- Performing Test HAVE_SOCKADDR_IN6_SIN6_LEN
-- Performing Test HAVE_SOCKADDR_IN6_SIN6_LEN - Failed
-- Performing Test HAVE_IMPLICIT_DEPENDENT_NAME_TYPING
-- Performing Test HAVE_IMPLICIT_DEPENDENT_NAME_TYPING - Failed
-- Looking for chown
-- Looking for chown - found
-- Looking for include file numaif.h
-- Looking for include file numaif.h - not found
-- Check size of socklen_t
-- Performing Test HAVE_IB_GCC_SYNC_SYNCHRONISE
-- Performing Test HAVE_IB_GCC_SYNC_SYNCHRONISE - Success
-- Performing Test HAVE_IB_GCC_ATOMIC_THREAD_FENCE
-- Performing Test HAVE_IB_GCC_ATOMIC_THREAD_FENCE - Failed
-- Performing Test HAVE_IB_GCC_ATOMIC_COMPARE_EXCHANGE
-- Performing Test HAVE_IB_GCC_ATOMIC_COMPARE_EXCHANGE - Failed
-- Performing Test HAVE_IB_ATOMIC_PTHREAD_T_GCC
-- Performing Test HAVE_IB_ATOMIC_PTHREAD_T_GCC - Success
-- Performing Test HAVE_IB_LINUX_FUTEX
-- Performing Test HAVE_IB_LINUX_FUTEX - Success
-- Looking for asprintf
-- Looking for asprintf - found
-- Using cmake version 2.8.12.2
-- Performing Test HAVE_UNUSED_BUT_SET_VARIABLE
-- Performing Test HAVE_UNUSED_BUT_SET_VARIABLE - Success
-- Disabling -Wunused-but-set-variable warning for building NDB
-- Performing Test HAVE_STRICT_ALIASING
-- Performing Test HAVE_STRICT_ALIASING - Success
-- Disabling -Wstrict-aliasing warning for building NDB
-- Not building NDB
-- Performing Test HAVE_PEERCRED
-- Performing Test HAVE_PEERCRED - Success
-- Using Boost headers from /opt/mysql-5.7.15/boost/boost_1_59_0
-- Performing Test CXX_HAVE_SIGN_COMPARE
-- Performing Test CXX_HAVE_SIGN_COMPARE - Success
-- Performing Test CXX_HAVE_UNUSED_VARIABLE
-- Performing Test CXX_HAVE_UNUSED_VARIABLE - Success
-- MYSQLX - Text log of protobuf messages enabled
-- MYSQLX - Enabled debug traces
-- Performing Test HAVE_UNUSED_PARAMETER
-- Performing Test HAVE_UNUSED_PARAMETER - Success
-- Performing Test HAVE_NO_DEPREC_CONST
-- Performing Test HAVE_NO_DEPREC_CONST - Success
-- Library mysqlclient depends on OSLIBS -lpthread;m;rt;dl
-- Looking for include file endian.h
-- Looking for include file endian.h - found
-- Looking for le64toh
-- Looking for le64toh - found
-- Looking for le32toh
-- Looking for le32toh - found
-- Looking for le16toh
-- Looking for le16toh - found
-- Check size of long long
-- Check size of long long - done
-- Check size of long
-- Check size of long - done
-- Check size of int
-- Check size of int - done
-- Check if the system is big endian
-- Searching 16 bit integer
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Found ZLIB: zlib (found version "1.2.3")
[ 98%] Built target mysql_client_test_embedded
Scanning dependencies of target mysql_embedded
[ 98%] Building CXX object libmysqld/examples/CMakeFiles/mysql_embedded.dir/__/__/client/completion_hash.cc.o
[100%] Building CXX object libmysqld/examples/CMakeFiles/mysql_embedded.dir/__/__/client/mysql.cc.o
[100%] Building CXX object libmysqld/examples/CMakeFiles/mysql_embedded.dir/__/__/client/readline.cc.o
Linking CXX executable mysql_embedded
[100%] Built target mysql_embedded
Scanning dependencies of target mysqltest_embedded
[100%] Building CXX object libmysqld/examples/CMakeFiles/mysqltest_embedded.dir/__/__/client/mysqltest.cc.o
Linking CXX executable mysqltest_embedded
[100%] Built target mysqltest_embedded
Scanning dependencies of target my_safe_process
[100%] Building CXX object mysql-test/lib/My/SafeProcess/CMakeFiles/my_safe_process.dir/safe_process.cc.o
Linking CXX executable my_safe_process
[100%] Built target my_safe_process
[root@ohs2 mysql-5.7.15]#
[root@ohs2 mysql-5.7.15]# make install
[  0%] Built target INFO_BIN
[  0%] Built target INFO_SRC
[  0%] Built target abi_check
[  0%] Built target zlib
[  1%] Built target yassl
[  2%] Built target taocrypt
[  4%] Built target edit
[  6%] Built target strings
[ 11%] Built target mysys
[ 11%] Built target dbug
[ 11%] Built target mysys_ssl
[ 11%] Built target comp_err
[ 11%] Built target GenError
[ 11%] Built target federated
[ 11%] Built target federated_embedded
[ 11%] Built target blackhole
[ 11%] Built target blackhole_embedded
[ 11%] Built target partition
[ 12%] Built target partition_embedded
[ 12%] Built target lz4_lib
[ 19%] Built target innobase
[ 20%] Built target heap
[ 21%] Built target heap_embedded
[ 22%] Built target hp_test1
[ 22%] Built target hp_test2
[ 24%] Built target myisammrg
[ 25%] Built target myisammrg_embedded
[ 25%] Built target archive
[ 25%] Built target archive_embedded
[ 28%] Built target myisam
[ 31%] Built target myisam_embedded
[ 31%] Built target myisam_ftdump
[ 31%] Built target myisamchk
[ 31%] Built target myisamlog
[ 31%] Built target myisampack
[ 32%] Built target mysqlservices
[ 32%] Built target example
[ 38%] Built target perfschema
[ 38%] Built target mytap
[ 38%] Built target pfs_server_stubs
[ 38%] Built target pfs-t
[ 38%] Built target pfs_account-oom-t
[ 38%] Built target gen_lex_hash
[ 39%] Built target GenServerSource
[ 39%] Built target csv
[ 39%] Built target ngram_parser
[ 39%] Built target regex
[ 39%] Built target vio
[ 40%] Built target binlogevents_static
[ 41%] Built target binlog
[ 41%] Built target rpl
[ 41%] Built target master
[ 42%] Built target slave
[ 42%] Built target comp_sql
[ 42%] Built target GenBootstrapPriv
[ 42%] Built target gen_lex_token
[ 42%] Built target GenDigestServerSource
[ 42%] Built target GenSysSchema
[ 54%] Built target sql
[ 54%] Built target pfs_connect_attr-t
[ 54%] Built target pfs_host-oom-t
[ 55%] Built target pfs_instr-oom-t
[ 55%] Built target pfs_instr-t
[ 55%] Built target pfs_instr_class-oom-t
[ 55%] Built target pfs_instr_class-t
[ 55%] Built target pfs_misc-t
[ 55%] Built target pfs_noop-t
[ 55%] Built target pfs_user-oom-t
[ 55%] Built target csv_embedded
[ 55%] Built target auth
[ 55%] Built target auth_socket
[ 55%] Built target auth_test_plugin
[ 55%] Built target mysql_no_login
[ 55%] Built target qa_auth_client
[ 55%] Built target qa_auth_interface
[ 55%] Built target qa_auth_server
[ 55%] Built target test_session_detach
[ 55%] Built target test_session_in_thd
[ 55%] Built target test_session_info
[ 55%] Built target test_sql_2_sessions
[ 55%] Built target test_sql_all_col_types
[ 55%] Built target test_sql_cmds_1
[ 55%] Built target test_sql_commit
[ 55%] Built target test_sql_complex
[ 55%] Built target test_sql_errors
[ 55%] Built target test_sql_lock
[ 55%] Built target test_sql_processlist
[ 55%] Built target test_sql_replication
[ 55%] Built target test_sql_shutdown
[ 55%] Built target test_sql_sqlmode
[ 55%] Built target test_sql_stored_procedures_functions
[ 55%] Built target test_sql_views_triggers
[ 55%] Built target test_x_sessions_deinit
[ 55%] Built target test_x_sessions_init
[ 56%] Built target ftexample
[ 56%] Built target audit_null
[ 56%] Built target test_security_context
[ 57%] Built target test_udf_services
[ 57%] Built target version_token
[ 57%] Built target keyring_file
[ 57%] Built target rewrite_example
[ 57%] Built target replication_observers_example
[ 57%] Built target test_framework
[ 58%] Built target test_services
[ 58%] Built target test_services_thread
[ 58%] Built target semisync_master
[ 59%] Built target semisync_slave
[ 59%] Built target validate_password
[ 59%] Built target daemon_example
[ 59%] Built target rewriter
[ 59%] Built target GenLiteProtos
[ 60%] Built target protobuf-lite
[ 61%] Built target event
[ 63%] Built target protobuf
[ 65%] Built target protoclib
[ 65%] Built target protoc
[ 70%] Built target xplugin
[ 70%] Built target mysqlx
[ 71%] Built target clientlib
[ 72%] Built target mysqlclient
[ 75%] Built target mysqlxtest
[ 76%] Built target keyring_udf
[ 76%] Built target re
[ 76%] Built target base64_test
[ 76%] Built target queues
[ 76%] Built target thr_lock
[ 76%] Built target libmysql
[ 76%] Built target libmysql_api_test
[ 76%] Built target binlogstandalone_shared
[ 77%] Built target binlogstandalone_static
[ 77%] Built target no_plan-t
[ 77%] Built target simple-t
[ 77%] Built target skip-t
[ 77%] Built target skip_all-t
[ 77%] Built target todo-t
[ 77%] Built target basic-t
[ 77%] Built target innochecksum
[ 77%] Built target lz4_decompress
[ 77%] Built target my_print_defaults
[ 77%] Built target perror
[ 78%] Built target replace
[ 78%] Built target resolve_stack_dump
[ 78%] Built target resolveip
[ 79%] Built target zlib_decompress
[ 79%] Built target mysql
[ 79%] Built target mysql_config_editor
[ 79%] Built target mysql_install_db
[ 79%] Built target mysql_plugin
[ 79%] Built target mysql_secure_installation
[ 79%] Built target mysql_ssl_rsa_setup
[ 79%] Built target GenFixPrivs
[ 79%] Built target mysqlcheck_core
[ 80%] Built target client_base
[ 80%] Built target mysql_upgrade
[ 80%] Built target mysqladmin
[ 80%] Built target mysqlbinlog
[ 80%] Built target mysqlcheck
[ 80%] Built target mysqldump
[ 80%] Built target mysqlimport
[ 80%] Built target mysqlshow
[ 80%] Built target mysqlslap
[ 80%] Built target mysqltest
[ 80%] Built target boost_lib
[ 84%] Built target mysqlpump_lib
[ 84%] Built target mysqlpump
[ 84%] Built target bug25714
[ 84%] Built target mysql_client_test
[ 84%] Built target locking_service
[ 84%] Built target mysql_tzinfo_to_sql
[ 84%] Built target mysqld
[ 85%] Built target sqlgunitlib
[ 85%] Built target udf_example
[ 85%] Built target GenYaccEmbeddedSource
[ 98%] Built target sql_embedded
[ 98%] Built target mysqlserver
[ 98%] Built target mysql_client_test_embedded
[100%] Built target mysql_embedded
[100%] Built target mysqltest_embedded
[100%] Built target my_safe_process
-- Installing: /usr/local/mysql/mysql-test/./t/subquery_sj_loosescan.test
-- Installing: /usr/local/mysql/mysql-test/./t/validate_password_plugin_check_user-master.opt
-- Installing: /usr/local/mysql/mysql-test/./t/partition_rename_longfilename.test
-- Installing: /usr/local/mysql/mysql-test/./t/optimizer_switch.test
-- Installing: /usr/local/mysql/mysql-test/./t/join_nested_bka.test
-- Installing: /usr/local/mysql/mysql-test/./t/sort_buffer_size_functionality.test
-- Installing: /usr/local/mysql/mysql-test/./t/user_limits.test
-- Installing: /usr/local/mysql/mysql-test/./t/connect.test
-- Installing: /usr/local/mysql/mysql-test/./t/innodb_disabled.test
-- Up-to-date: /usr/local/mysql/mysql-test/mtr
-- Up-to-date: /usr/local/mysql/mysql-test/mysql-test-run
-- Installing: /usr/local/mysql/mysql-test/lib/My/SafeProcess/my_safe_process
-- Up-to-date: /usr/local/mysql/mysql-test/lib/My/SafeProcess/my_safe_process
-- Installing: /usr/local/mysql/mysql-test/lib/My/SafeProcess/Base.pm
-- Installing: /usr/local/mysql/support-files/my-default.cnf
-- Installing: /usr/local/mysql/support-files/mysqld_multi.server
-- Installing: /usr/local/mysql/support-files/mysql-log-rotate
-- Installing: /usr/local/mysql/support-files/magic
-- Installing: /usr/local/mysql/share/aclocal/mysql.m4
-- Installing: /usr/local/mysql/support-files/mysql.server
[root@ohs2 mysql-5.7.15]# 
[root@ohs2 mysql-5.7.15]# 
[root@ohs2 mysql-5.7.15]# make package(打包,可选步骤)
[root@ohs2 mysql-5.7.15]# make package
[  0%] Built target INFO_BIN
[  0%] Built target INFO_SRC
[  0%] Built target abi_check
[  0%] Built target zlib
[  1%] Built target yassl
[  2%] Built target taocrypt
[  4%] Built target edit
[  6%] Built target strings
[ 11%] Built target mysys
[ 11%] Built target dbug
[ 11%] Built target mysys_ssl
[ 11%] Built target comp_err
[ 11%] Built target GenError
[ 11%] Built target federated
[ 11%] Built target federated_embedded
[ 11%] Built target blackhole
[ 11%] Built target blackhole_embedded
[ 11%] Built target partition
[ 12%] Built target partition_embedded
[ 12%] Built target lz4_lib
[ 19%] Built target innobase
[ 20%] Built target heap
[ 21%] Built target heap_embedded
[ 22%] Built target hp_test1
[ 22%] Built target hp_test2
[ 24%] Built target myisammrg
[ 25%] Built target myisammrg_embedded
[ 25%] Built target archive
[ 25%] Built target archive_embedded
[ 28%] Built target myisam
[ 31%] Built target myisam_embedded
[ 31%] Built target myisam_ftdump
[ 31%] Built target myisamchk
[ 31%] Built target myisamlog
[ 31%] Built target myisampack
[ 32%] Built target mysqlservices
[ 32%] Built target example
[ 38%] Built target perfschema
[ 38%] Built target mytap
[ 38%] Built target pfs_server_stubs
[ 38%] Built target pfs-t
[ 38%] Built target pfs_account-oom-t
[ 38%] Built target gen_lex_hash
[ 39%] Built target GenServerSource
[ 39%] Built target csv
[ 39%] Built target ngram_parser
[ 39%] Built target regex
[ 39%] Built target vio
[ 40%] Built target binlogevents_static
[ 41%] Built target binlog
[ 41%] Built target rpl
[ 41%] Built target master
[ 42%] Built target slave
[ 42%] Built target comp_sql
[ 42%] Built target GenBootstrapPriv
[ 42%] Built target gen_lex_token
[ 42%] Built target GenDigestServerSource
[ 42%] Built target GenSysSchema
[ 54%] Built target sql
[ 54%] Built target pfs_connect_attr-t
[ 54%] Built target pfs_host-oom-t
[ 55%] Built target pfs_instr-oom-t
[ 55%] Built target pfs_instr-t
[ 55%] Built target pfs_instr_class-oom-t
[ 55%] Built target pfs_instr_class-t
[ 55%] Built target pfs_misc-t
[ 55%] Built target pfs_noop-t
[ 55%] Built target pfs_user-oom-t
[ 55%] Built target csv_embedded
[ 55%] Built target auth
[ 55%] Built target auth_socket
[ 55%] Built target auth_test_plugin
[ 55%] Built target mysql_no_login
[ 55%] Built target qa_auth_client
[ 55%] Built target qa_auth_interface
[ 55%] Built target qa_auth_server
[ 55%] Built target test_session_detach
[ 55%] Built target test_session_in_thd
[ 55%] Built target test_session_info
[ 55%] Built target test_sql_2_sessions
[ 55%] Built target test_sql_all_col_types
[ 55%] Built target test_sql_cmds_1
[ 55%] Built target test_sql_commit
[ 55%] Built target test_sql_complex
[ 55%] Built target test_sql_errors
[ 55%] Built target test_sql_lock
[ 55%] Built target test_sql_processlist
[ 55%] Built target test_sql_replication
[ 55%] Built target test_sql_shutdown
[ 55%] Built target test_sql_sqlmode
[ 55%] Built target test_sql_stored_procedures_functions
[ 55%] Built target test_sql_views_triggers
[ 55%] Built target test_x_sessions_deinit
[ 55%] Built target test_x_sessions_init
[ 56%] Built target ftexample
[ 56%] Built target audit_null
[ 56%] Built target test_security_context
[ 57%] Built target test_udf_services
[ 57%] Built target version_token
[ 57%] Built target keyring_file
[ 57%] Built target rewrite_example
[ 57%] Built target replication_observers_example
[ 57%] Built target test_framework
[ 58%] Built target test_services
[ 58%] Built target test_services_thread
[ 58%] Built target semisync_master
[ 59%] Built target semisync_slave
[ 59%] Built target validate_password
[ 59%] Built target daemon_example
[ 59%] Built target rewriter
[ 59%] Built target GenLiteProtos
[ 60%] Built target protobuf-lite
[ 61%] Built target event
[ 63%] Built target protobuf
[ 65%] Built target protoclib
[ 65%] Built target protoc
[ 70%] Built target xplugin
[ 70%] Built target mysqlx
[ 71%] Built target clientlib
[ 72%] Built target mysqlclient
[ 75%] Built target mysqlxtest
[ 76%] Built target keyring_udf
[ 76%] Built target re
[ 76%] Built target base64_test
[ 76%] Built target queues
[ 76%] Built target thr_lock
[ 76%] Built target libmysql
[ 76%] Built target libmysql_api_test
[ 76%] Built target binlogstandalone_shared
[ 77%] Built target binlogstandalone_static
[ 77%] Built target no_plan-t
[ 77%] Built target simple-t
[ 77%] Built target skip-t
[ 77%] Built target skip_all-t
[ 77%] Built target todo-t
[ 77%] Built target basic-t
[ 77%] Built target innochecksum
[ 77%] Built target lz4_decompress
[ 77%] Built target my_print_defaults
[ 77%] Built target perror
[ 78%] Built target replace
[ 78%] Built target resolve_stack_dump
[ 78%] Built target resolveip
[ 79%] Built target zlib_decompress
[ 79%] Built target mysql
[ 79%] Built target mysql_config_editor
[ 79%] Built target mysql_install_db
[ 79%] Built target mysql_plugin
[ 79%] Built target mysql_secure_installation
[ 79%] Built target mysql_ssl_rsa_setup
[ 79%] Built target GenFixPrivs
[ 79%] Built target mysqlcheck_core
[ 80%] Built target client_base
[ 80%] Built target mysql_upgrade
[ 80%] Built target mysqladmin
[ 80%] Built target mysqlbinlog
[ 80%] Built target mysqlcheck
[ 80%] Built target mysqldump
[ 80%] Built target mysqlimport
[ 80%] Built target mysqlshow
[ 80%] Built target mysqlslap
[ 80%] Built target mysqltest
[ 80%] Built target boost_lib
[ 84%] Built target mysqlpump_lib
[ 84%] Built target mysqlpump
[ 84%] Built target bug25714
[ 84%] Built target mysql_client_test
[ 84%] Built target locking_service
[ 84%] Built target mysql_tzinfo_to_sql
[ 84%] Built target mysqld
[ 85%] Built target sqlgunitlib
[ 85%] Built target udf_example
[ 85%] Built target GenYaccEmbeddedSource
[ 98%] Built target sql_embedded
[ 98%] Built target mysqlserver
[ 98%] Built target mysql_client_test_embedded
[100%] Built target mysql_embedded
[100%] Built target mysqltest_embedded
[100%] Built target my_safe_process
Run CPack packaging tool...
CPack: Create package using TGZ
CPack: Install projects
CPack: - Run preinstall target for: MySQL
CPack: - Install project: MySQL
CPack: Create package
CPack: - package: /opt/mysql-5.7.15/mysql-5.7.15-linux-x86_64.tar.gz generated.
[root@ohs2 mysql-5.7.15]# 


Postinstallation setup

# Postinstallation setup
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysql_install_db --user=mysql    # Before MySQL 5.7.6
shell> bin/mysqld --initialize --user=mysql # MySQL 5.7.6 and up
shell> bin/mysql_ssl_rsa_setup              # MySQL 5.7.6 and up
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

[root@ohs2 ~]# cd /usr/local/mysql

[root@ohs2 mysql]# chown -R mysql .
[root@ohs2 mysql]# chgrp -R mysql .
[root@ohs2 mysql]# bin/mysqld --initialize --user=mysql
2016-09-26T19:10:16.603810Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-09-26T19:10:16.987725Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-09-26T19:10:17.148680Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-09-26T19:10:17.223451Z 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: dc5a4946-841c-11e6-bfb6-080027ba9d73.
2016-09-26T19:10:17.225186Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-09-26T19:10:17.227975Z 1 [Note] A temporary password is generated for root@localhost: DNIzl#ynq0T-
[root@ohs2 mysql]#
[root@ohs2 mysql]# bin/mysql_ssl_rsa_setup
Generating a 2048 bit RSA private key
....+++
...................................................................................+++
writing new private key to 'ca-key.pem'
-----
Generating a 2048 bit RSA private key
................................................+++
..........................................................+++
writing new private key to 'server-key.pem'
-----
Generating a 2048 bit RSA private key
.........................................................................................+++
.............+++
writing new private key to 'client-key.pem'
-----
[root@ohs2 mysql]#
[root@ohs2 mysql]#
[root@ohs2 mysql]# chown -R root .
[root@ohs2 mysql]# chown -R mysql data
[root@ohs2 mysql]# bin/mysqld_safe --user=mysql &
[1] 32632
[root@ohs2 mysql]# 2016-09-26T19:11:07.190353Z mysqld_safe Logging to '/usr/local/mysql/data/ohs2.ohsdba.cn.err'.
2016-09-26T19:11:07.210266Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
[root@ohs2 mysql]# cp support-files/mysql.server /etc/init.d/mysql.server
[root@ohs2 mysql]# 


MySQL debug版本初体验

[root@ohs2 ~]# /usr/local/mysql/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.15-debug Source distribution
Copyright (c) 2000, 2016, 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@ohs2 bin]# ./mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.15-debug

Copyright (c) 2000, 2016, 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> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'ohsdba';
Query OK, 0 rows affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| engine_cost               |
| event                     |
| func                      |
| general_log               |
| gtid_executed             |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| innodb_index_stats        |
| innodb_table_stats        |
| ndb_binlog_index          |
| plugin                    |
| proc                      |
| procs_priv                |
| proxies_priv              |
| server_cost               |
| servers                   |
| slave_master_info         |
| slave_relay_log_info      |
| slave_worker_info         |
| slow_log                  |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
+---------------------------+
31 rows in set (0.00 sec)

mysql> 
mysql> status;
--------------
./mysql  Ver 14.14 Distrib 5.7.15, for Linux (x86_64) using  EditLine wrapper

Connection id:          4
Current database:       mysql
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.7.15-debug
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /tmp/mysql.sock
Uptime:                 19 min 53 sec

Threads: 1  Questions: 47  Slow queries: 0  Opens: 136  Flush tables: 1  Open tables: 129  Queries per second avg: 0.039
--------------
mysql> 


Reference

http://dev.mysql.com/doc/

http://dev.mysql.com/doc/refman/5.7/en/

http://www.cmake.org
http://www.gnu.org/software/make/

http://www.boost.org/

http://baike.baidu.com/item/mySQL/471251

http://dev.mysql.com/doc/refman/5.7/en/source-installation.html
http://dev.mysql.com/doc/refman/5.7/en/installing-source-distribution.html
http://dev.mysql.com/doc/refman/8.0/en/source-installation.html
http://dev.mysql.com/doc/refman/8.0/en/installing-source-distribution.html
http://bugs.mysql.com/bug.php?id=70647



关键词:mysql 

相关文章

OGG from MySQL to Oracle
MySQL数据库高可用实践
Install oracle products on docker
MySQL Cookbook for Oracle DBA
MySQL HA - Innodb Cluster
腾讯微信的PhxSQL数据库
MySQL Group Replication(MGR)
MySQL and Oracle Enterprise Manager
MySQL Tools for performance, backup, monitor
MySQL Multi-Master Single-Slave Replication
MySQL and GPL
MySQL monthly report from alibaba
Top