MySQL 5.7.9原始碼編譯安裝說明
一、環境說明
1.作業系統
系統版本:RHEL 6.3 X64
作業系統安裝型別:Basic
系統安裝包:gcc gcc-c++ bzip2(default) bzip2-devel bzip2-libs(default) python-devel ncurses-devel bison
1)gcc gcc-c++
[root@mdb01 Packages]# rpm -ivh kernel-headers-2.6.32-279.el6.x86_64.rpm
warning: kernel-headers-2.6.32-279.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:kernel-headers ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh glibc-headers-2.12-1.80.el6.x86_64.rpm
warning: glibc-headers-2.12-1.80.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:glibc-headers ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh glibc-devel-2.12-1.80.el6.x86_64.rpm
warning: glibc-devel-2.12-1.80.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:glibc-devel ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh mpfr-2.4.1-6.el6.x86_64.rpm
warning: mpfr-2.4.1-6.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:mpfr ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh cpp-4.4.6-4.el6.x86_64.rpm
warning: cpp-4.4.6-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:cpp ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh ppl-0.10.2-11.el6.x86_64.rpm
warning: ppl-0.10.2-11.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:ppl ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh cloog-ppl-0.15.7-1.2.el6.x86_64.rpm
warning: cloog-ppl-0.15.7-1.2.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:cloog-ppl ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh gcc-4.4.6-4.el6.x86_64.rpm
warning: gcc-4.4.6-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:gcc ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh libstdc++-devel-4.4.6-4.el6.x86_64.rpm
warning: libstdc++-devel-4.4.6-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:libstdc++-devel ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh gcc-c++-4.4.6-4.el6.x86_64.rpm
warning: gcc-c++-4.4.6-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:gcc-c++ ########################################### [100%]
2)bzip2-devel python-devel
[root@mdb01 Packages]# rpm -ivh bzip2-devel-1.0.5-7.el6_0.x86_64.rpm
warning: bzip2-devel-1.0.5-7.el6_0.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:bzip2-devel ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh python-devel-2.6.6-29.el6_2.2.x86_64.rpm
warning: python-devel-2.6.6-29.el6_2.2.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:python-devel ########################################### [100%]
Boost系統相關包安裝檢查
[root@mdb01 Packages]# rpm -q gcc gcc-c++ bzip2 bzip2-devel bzip2-libs python-devel
gcc-4.4.6-4.el6.x86_64
gcc-c++-4.4.6-4.el6.x86_64
bzip2-1.0.5-7.el6_0.x86_64
bzip2-devel-1.0.5-7.el6_0.x86_64
bzip2-libs-1.0.5-7.el6_0.x86_64
python-devel-2.6.6-29.el6_2.2.x86_64
二.cmake-3.3.2
# ./bootstrap && make && make install
三.boost_1_59_0
1.預編譯配置
[root@mdb01 boost_1_59_0]# ./bootstrap.sh
Building Boost.Build engine with toolset gcc... tools/build/src/engine/bin.linuxx86_64/b2
Detecting Python version... 2.6
Detecting Python root... /usr
Unicode/ICU support for Boost.Regex?... not found.
Generating Boost.Build configuration in project-config.jam...
Bootstrapping is done. To build, run:
./b2
To adjust configuration, edit 'project-config.jam'.
Further information:
- Command line help:
./b2 --help
- Getting started guide:
- Boost.Build documentation:
2.編譯
[root@rhel6 boost_1_59_0]#./b2
...........
..........
...on 1100th target...
gcc.compile.c++ bin.v2/libs/wave/build/gcc-4.4.6/release/link-static/threading-multi/wave_config_constant.o
common.mkdir bin.v2/libs/wave/build/gcc-4.4.6/release/link-static/threading-multi/cpplexer
common.mkdir bin.v2/libs/wave/build/gcc-4.4.6/release/link-static/threading-multi/cpplexer/re2clex
gcc.compile.c++ bin.v2/libs/wave/build/gcc-4.4.6/release/link-static/threading-multi/cpplexer/re2clex/aq.o
gcc.compile.c++ bin.v2/libs/wave/build/gcc-4.4.6/release/link-static/threading-multi/cpplexer/re2clex/cpp_re.o
gcc.archive bin.v2/libs/wave/build/gcc-4.4.6/release/link-static/threading-multi/libboost_wave.a
common.copy stage/lib/libboost_wave.a
...updated 1107 targets...
The Boost C++ Libraries were successfully built! (表示編譯成功)
The following directory should be added to compiler include paths:
/home/soft/boost_1_59_0
The following directory should be added to linker library paths:
/home/soft/boost_1_59_0/stage/lib
3.安裝
[root@mdb01 boost_1_59_0]#./b2 install
...........
...........
common.copy /usr/local/lib/libboost_signals.so.1.59.0
ln-UNIX /usr/local/lib/libboost_signals.so
common.copy /usr/local/lib/libboost_timer.so.1.59.0
ln-UNIX /usr/local/lib/libboost_timer.so
common.copy /usr/local/lib/libboost_prg_exec_monitor.so.1.59.0
ln-UNIX /usr/local/lib/libboost_prg_exec_monitor.so
common.copy /usr/local/lib/libboost_unit_test_framework.so.1.59.0
ln-UNIX /usr/local/lib/libboost_unit_test_framework.so
common.copy /usr/local/lib/libboost_wave.so.1.59.0
ln-UNIX /usr/local/lib/libboost_wave.so
common.copy /usr/local/lib/libboost_exception.a
common.copy /usr/local/lib/libboost_system.a
common.copy /usr/local/lib/libboost_chrono.a
common.copy /usr/local/lib/libboost_timer.a
common.copy /usr/local/lib/libboost_test_exec_monitor.a
...updated 11816 targets...
四.mysql
1.MySQL原始碼安裝系統需求
Source Installation System Requirements
Installation of MySQL from source requires several
development tools. Some of these tools are needed no matter
whether you use a standard source distribution or a
development source tree. Other tool requirements depend on
which installation method you use.
To install MySQL from source, your system must have the
following tools, regardless of installation method:
* CMake, which is used as the build framework on all
platforms. CMake can be downloaded from
* A good make program. Although some platforms come with
their own make implementations, it is highly recommended
that you use GNU make 3.75 or newer. It may already be
available on your system as gmake. GNU make is available
from
* A working ANSI C++ compiler. GCC 4.4.6 or later, Clang
3.3 or later (FreeBSD and OS X), Visual Studio 2013 or
later, and many current vendor-supplied compilers are
known to work.
* Perl is needed if you intend to run test scripts. Most
Unix-like systems include Perl. On Windows, you can use a
version such as ActiveState Perl.
2.檢查系統包版本
1) cmake
[root@mdb01 cmake-3.3.2]# cmake --version
cmake version 3.3.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
2) make
[root@mdb01 cmake-3.3.2]# make -v
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
3) gcc
[root@mdb01 cmake-3.3.2]# gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl= --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)
4) perl
[root@mdb01 cmake-3.3.2]# perl -v
This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi
Copyright 1987-2009, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at the Perl Home Page.
5) 其它系統包
ncurses-devel bison
[root@mdb01 Packages]# rpm -ivh ncurses-devel-5.7-3.20090208.el6.x86_64.rpm
warning: ncurses-devel-5.7-3.20090208.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:ncurses-devel ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh bison-2.4.1-5.el6.x86_64.rpm
warning: bison-2.4.1-5.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:bison ########################################### [100%]
3.安裝前配置
# Preconfiguration setup
[root@mdb01 soft]# groupadd mysql
[root@mdb01 soft]# useradd -r -g mysql mysql
# Beginning of source-build specific instructions
[root@mdb01 soft]# tar zxvf mysql-5.7.9.tar.gz
[root@mdb01 soft]# cd mysql-5.7.9
4.配置安裝項
[root@mdb01 mysql-5.7.9]# cmake \
-DCMAKE_INSTALL_PREFIX=/opt/mysql \
-DMYSQL_DATADIR=/opt/mysql/data \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DMYSQL_UNIX_ADDR=/opt/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
5.編譯MySQL
[root@mdb01 mysql-5.7.9]# make
6.安裝MySQL
[root@mdb01 mysql-5.7.9]# make install
# End of source-build specific instructions
五、安裝後配置
# Postinstallation setup
1.目錄許可權
shell> cd /opt/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
2.初始化資料庫
shell> bin/mysql_install_db --user=mysql # Before MySQL 5.7.6
shell> bin/mysqld --initialize --user=mysql # MySQL 5.7.6 and up
執行結果:
[root@mdb01 mysql]# bin/mysqld --initialize --user=mysql
2015-10-29T21:58:57.465483Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-10-29T21:58:59.889999Z 0 [Warning] InnoDB: New log files created, LSN=45790
2015-10-29T21:59:00.201432Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2015-10-29T21:59:00.398966Z 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: 42ad8740-7e88-11e5-83de-000c29270868.
2015-10-29T21:59:00.406427Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2015-10-29T21:59:00.424627Z 1 [Note] A temporary password is generated for root@localhost: Ek&!sA9(qYds
[root@mdb01 mysql]# ls
bin COPYING data docs include INSTALL-BINARY lib man mysql-test README share support-files
[root@mdb01 mysql]#
3.證照相關
shell> bin/mysql_ssl_rsa_setup # MySQL 5.7.6 and up
執行結果
[root@mdb01 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'
-----
4.目錄許可權修改
shell> chown -R root .
shell> chown -R mysql data
Basedir mysql user
[root@mdb01 mysql-5.7.9]# cd /opt
[root@mdb01 opt]# chown mysql mysql
[root@mdb01 opt]# ll
total 4
drwxr-xr-x. 11 mysql mysql 4096 Oct 30 06:09 mysql
5.啟動 MySQL
shell> bin/mysqld_safe --user=mysql &
六、首次登陸 MySQL
1.登入MySQL
[root@rhel6 mysql]# bin/mysql -u root -p
Enter password: 安裝時生成的臨時密碼(Ek&!sA9(qYds)
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.9-log
Copyright (c) 2000, 2015, 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>
2.修改登入密碼root密碼
* As of MySQL 5.7.6, use ALTER USER:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.02 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
3.配置啟動項
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysqld
PATH環境變數
[root@rhel6 ~]# vim /etc/profile
.....
.....
unset i
unset pathmunge
export PATH=/opt/mysql/bin:$PATH
1.作業系統
系統版本:RHEL 6.3 X64
作業系統安裝型別:Basic
系統安裝包:gcc gcc-c++ bzip2(default) bzip2-devel bzip2-libs(default) python-devel ncurses-devel bison
1)gcc gcc-c++
[root@mdb01 Packages]# rpm -ivh kernel-headers-2.6.32-279.el6.x86_64.rpm
warning: kernel-headers-2.6.32-279.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:kernel-headers ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh glibc-headers-2.12-1.80.el6.x86_64.rpm
warning: glibc-headers-2.12-1.80.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:glibc-headers ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh glibc-devel-2.12-1.80.el6.x86_64.rpm
warning: glibc-devel-2.12-1.80.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:glibc-devel ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh mpfr-2.4.1-6.el6.x86_64.rpm
warning: mpfr-2.4.1-6.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:mpfr ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh cpp-4.4.6-4.el6.x86_64.rpm
warning: cpp-4.4.6-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:cpp ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh ppl-0.10.2-11.el6.x86_64.rpm
warning: ppl-0.10.2-11.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:ppl ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh cloog-ppl-0.15.7-1.2.el6.x86_64.rpm
warning: cloog-ppl-0.15.7-1.2.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:cloog-ppl ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh gcc-4.4.6-4.el6.x86_64.rpm
warning: gcc-4.4.6-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:gcc ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh libstdc++-devel-4.4.6-4.el6.x86_64.rpm
warning: libstdc++-devel-4.4.6-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:libstdc++-devel ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh gcc-c++-4.4.6-4.el6.x86_64.rpm
warning: gcc-c++-4.4.6-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:gcc-c++ ########################################### [100%]
2)bzip2-devel python-devel
[root@mdb01 Packages]# rpm -ivh bzip2-devel-1.0.5-7.el6_0.x86_64.rpm
warning: bzip2-devel-1.0.5-7.el6_0.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:bzip2-devel ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh python-devel-2.6.6-29.el6_2.2.x86_64.rpm
warning: python-devel-2.6.6-29.el6_2.2.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:python-devel ########################################### [100%]
Boost系統相關包安裝檢查
[root@mdb01 Packages]# rpm -q gcc gcc-c++ bzip2 bzip2-devel bzip2-libs python-devel
gcc-4.4.6-4.el6.x86_64
gcc-c++-4.4.6-4.el6.x86_64
bzip2-1.0.5-7.el6_0.x86_64
bzip2-devel-1.0.5-7.el6_0.x86_64
bzip2-libs-1.0.5-7.el6_0.x86_64
python-devel-2.6.6-29.el6_2.2.x86_64
二.cmake-3.3.2
# ./bootstrap && make && make install
三.boost_1_59_0
1.預編譯配置
[root@mdb01 boost_1_59_0]# ./bootstrap.sh
Building Boost.Build engine with toolset gcc... tools/build/src/engine/bin.linuxx86_64/b2
Detecting Python version... 2.6
Detecting Python root... /usr
Unicode/ICU support for Boost.Regex?... not found.
Generating Boost.Build configuration in project-config.jam...
Bootstrapping is done. To build, run:
./b2
To adjust configuration, edit 'project-config.jam'.
Further information:
- Command line help:
./b2 --help
- Getting started guide:
- Boost.Build documentation:
2.編譯
[root@rhel6 boost_1_59_0]#./b2
...........
..........
...on 1100th target...
gcc.compile.c++ bin.v2/libs/wave/build/gcc-4.4.6/release/link-static/threading-multi/wave_config_constant.o
common.mkdir bin.v2/libs/wave/build/gcc-4.4.6/release/link-static/threading-multi/cpplexer
common.mkdir bin.v2/libs/wave/build/gcc-4.4.6/release/link-static/threading-multi/cpplexer/re2clex
gcc.compile.c++ bin.v2/libs/wave/build/gcc-4.4.6/release/link-static/threading-multi/cpplexer/re2clex/aq.o
gcc.compile.c++ bin.v2/libs/wave/build/gcc-4.4.6/release/link-static/threading-multi/cpplexer/re2clex/cpp_re.o
gcc.archive bin.v2/libs/wave/build/gcc-4.4.6/release/link-static/threading-multi/libboost_wave.a
common.copy stage/lib/libboost_wave.a
...updated 1107 targets...
The Boost C++ Libraries were successfully built! (表示編譯成功)
The following directory should be added to compiler include paths:
/home/soft/boost_1_59_0
The following directory should be added to linker library paths:
/home/soft/boost_1_59_0/stage/lib
3.安裝
[root@mdb01 boost_1_59_0]#./b2 install
...........
...........
common.copy /usr/local/lib/libboost_signals.so.1.59.0
ln-UNIX /usr/local/lib/libboost_signals.so
common.copy /usr/local/lib/libboost_timer.so.1.59.0
ln-UNIX /usr/local/lib/libboost_timer.so
common.copy /usr/local/lib/libboost_prg_exec_monitor.so.1.59.0
ln-UNIX /usr/local/lib/libboost_prg_exec_monitor.so
common.copy /usr/local/lib/libboost_unit_test_framework.so.1.59.0
ln-UNIX /usr/local/lib/libboost_unit_test_framework.so
common.copy /usr/local/lib/libboost_wave.so.1.59.0
ln-UNIX /usr/local/lib/libboost_wave.so
common.copy /usr/local/lib/libboost_exception.a
common.copy /usr/local/lib/libboost_system.a
common.copy /usr/local/lib/libboost_chrono.a
common.copy /usr/local/lib/libboost_timer.a
common.copy /usr/local/lib/libboost_test_exec_monitor.a
...updated 11816 targets...
四.mysql
1.MySQL原始碼安裝系統需求
Source Installation System Requirements
Installation of MySQL from source requires several
development tools. Some of these tools are needed no matter
whether you use a standard source distribution or a
development source tree. Other tool requirements depend on
which installation method you use.
To install MySQL from source, your system must have the
following tools, regardless of installation method:
* CMake, which is used as the build framework on all
platforms. CMake can be downloaded from
* A good make program. Although some platforms come with
their own make implementations, it is highly recommended
that you use GNU make 3.75 or newer. It may already be
available on your system as gmake. GNU make is available
from
* A working ANSI C++ compiler. GCC 4.4.6 or later, Clang
3.3 or later (FreeBSD and OS X), Visual Studio 2013 or
later, and many current vendor-supplied compilers are
known to work.
* Perl is needed if you intend to run test scripts. Most
Unix-like systems include Perl. On Windows, you can use a
version such as ActiveState Perl.
2.檢查系統包版本
1) cmake
[root@mdb01 cmake-3.3.2]# cmake --version
cmake version 3.3.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
2) make
[root@mdb01 cmake-3.3.2]# make -v
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
3) gcc
[root@mdb01 cmake-3.3.2]# gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl= --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)
4) perl
[root@mdb01 cmake-3.3.2]# perl -v
This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi
Copyright 1987-2009, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at the Perl Home Page.
5) 其它系統包
ncurses-devel bison
[root@mdb01 Packages]# rpm -ivh ncurses-devel-5.7-3.20090208.el6.x86_64.rpm
warning: ncurses-devel-5.7-3.20090208.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:ncurses-devel ########################################### [100%]
[root@mdb01 Packages]# rpm -ivh bison-2.4.1-5.el6.x86_64.rpm
warning: bison-2.4.1-5.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:bison ########################################### [100%]
3.安裝前配置
# Preconfiguration setup
[root@mdb01 soft]# groupadd mysql
[root@mdb01 soft]# useradd -r -g mysql mysql
# Beginning of source-build specific instructions
[root@mdb01 soft]# tar zxvf mysql-5.7.9.tar.gz
[root@mdb01 soft]# cd mysql-5.7.9
4.配置安裝項
[root@mdb01 mysql-5.7.9]# cmake \
-DCMAKE_INSTALL_PREFIX=/opt/mysql \
-DMYSQL_DATADIR=/opt/mysql/data \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DMYSQL_UNIX_ADDR=/opt/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
5.編譯MySQL
[root@mdb01 mysql-5.7.9]# make
6.安裝MySQL
[root@mdb01 mysql-5.7.9]# make install
# End of source-build specific instructions
五、安裝後配置
# Postinstallation setup
1.目錄許可權
shell> cd /opt/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
2.初始化資料庫
shell> bin/mysql_install_db --user=mysql # Before MySQL 5.7.6
shell> bin/mysqld --initialize --user=mysql # MySQL 5.7.6 and up
執行結果:
[root@mdb01 mysql]# bin/mysqld --initialize --user=mysql
2015-10-29T21:58:57.465483Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-10-29T21:58:59.889999Z 0 [Warning] InnoDB: New log files created, LSN=45790
2015-10-29T21:59:00.201432Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2015-10-29T21:59:00.398966Z 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: 42ad8740-7e88-11e5-83de-000c29270868.
2015-10-29T21:59:00.406427Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2015-10-29T21:59:00.424627Z 1 [Note] A temporary password is generated for root@localhost: Ek&!sA9(qYds
[root@mdb01 mysql]# ls
bin COPYING data docs include INSTALL-BINARY lib man mysql-test README share support-files
[root@mdb01 mysql]#
3.證照相關
shell> bin/mysql_ssl_rsa_setup # MySQL 5.7.6 and up
執行結果
[root@mdb01 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'
-----
4.目錄許可權修改
shell> chown -R root .
shell> chown -R mysql data
Basedir mysql user
[root@mdb01 mysql-5.7.9]# cd /opt
[root@mdb01 opt]# chown mysql mysql
[root@mdb01 opt]# ll
total 4
drwxr-xr-x. 11 mysql mysql 4096 Oct 30 06:09 mysql
5.啟動 MySQL
shell> bin/mysqld_safe --user=mysql &
六、首次登陸 MySQL
1.登入MySQL
[root@rhel6 mysql]# bin/mysql -u root -p
Enter password: 安裝時生成的臨時密碼(Ek&!sA9(qYds)
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.9-log
Copyright (c) 2000, 2015, 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>
2.修改登入密碼root密碼
* As of MySQL 5.7.6, use ALTER USER:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.02 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
3.配置啟動項
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysqld
PATH環境變數
[root@rhel6 ~]# vim /etc/profile
.....
.....
unset i
unset pathmunge
export PATH=/opt/mysql/bin:$PATH
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9034054/viewspace-2074941/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【轉】MySQL原始碼編譯安裝MySql原始碼編譯
- MySQL5.7.16原始碼編譯安裝MySql原始碼編譯
- 阿里雲mysql原始碼編譯安裝阿里MySql原始碼編譯
- 原始碼編譯安裝Redis原始碼編譯Redis
- Mysql5.6 for Centos6.5原始碼編譯安裝MySqlCentOS原始碼編譯
- 原始碼編譯安裝的原理原始碼編譯
- Ubuntu 16.04下 Mysql5.7.17原始碼編譯與安裝UbuntuMySql原始碼編譯
- GDB 除錯 Mysql 實戰(一)原始碼編譯安裝除錯MySql原始碼編譯
- 基於Linux的MySQL5.7原始碼編譯安裝LinuxMySql原始碼編譯
- nginx原始碼編譯安裝(詳解)Nginx原始碼編譯
- linux-原始碼的編譯安裝和解除安裝Linux原始碼編譯
- Greenplum_原始碼編譯安裝和RPM包安裝原始碼編譯
- CentOS 7.4 環境下原始碼編譯(多例項)安裝 Mysql 5.7.26CentOS原始碼編譯MySql
- 【MySQL安裝】Linux下安裝MySQL(預編譯)MySqlLinux編譯
- Linux環境PostGIS原始碼編譯安裝Linux原始碼編譯
- 04 原始碼編譯安裝與介紹原始碼編譯
- PostgreSQL原始碼學習 win10原始碼編譯安裝SQL原始碼Win10編譯
- CentOS6.9原始碼編譯安裝nginx+php7+mysql環境CentOS原始碼編譯NginxPHPMySql
- 龍芯麒麟原始碼編譯MySQL生成軟體包進行安裝原始碼編譯MySql
- Ubuntu 16.04原始碼編譯安裝Apache 2.4.25教程Ubuntu原始碼編譯Apache
- Centos7下原始碼編譯安裝apacheCentOS原始碼編譯Apache
- 龍芯原始碼編譯MySQL原始碼編譯MySql
- 編譯安裝nginx-php-mysql編譯NginxPHPMySql
- 如何編譯安裝MySQL8.0編譯MySql
- [環境搭建] 透過原始碼編譯安裝 Redis原始碼編譯Redis
- Nginx1.19 php8.0 原始碼編譯安裝NginxPHP原始碼編譯
- Centos7安裝(四)抓包工具wireshark原始碼編譯安裝CentOS原始碼編譯
- 連網安裝mysql與原始碼安裝mysqlMySql原始碼
- MySQL 5.7.28 原始碼安裝MySql原始碼
- 麒麟系統開發筆記(三):從Qt原始碼編譯安裝之編譯安裝Qt5.12筆記QT原始碼編譯
- tesseract安裝說明
- CentOS 7.4 環境下原始碼編譯安裝 postgreSQL 11.4CentOS原始碼編譯SQL
- Ubuntu20.04 從原始碼編譯安裝 python3.10Ubuntu原始碼編譯Python
- Cnetos7編譯安裝MySQL教程。編譯MySql
- orthanc 編譯安裝mysql S3編譯MySqlS3
- RK3399 android編譯說明Android編譯
- Mysql for Linux安裝配置之—— 原始碼安裝MySqlLinux原始碼
- mysql5.5.20原始碼安裝MySql原始碼
- MySQL免編譯安裝及登入(5.6.36)MySql編譯