CentOS 7.2 编译安装 MySQL 5.6.36 | IT运维网
  • 本站启用了账户登录密码错误就锁定模式,如有人误操作被锁请邮件(yvan.lu@ityww.cn)告知我账户名。
  • 本站为个人技术性站点,上面会更新一些系统、网络、虚拟化及云计算等相关的文章,与大家一起参考、学习和交流。
  • 欢迎访问本网站;本站QQ交流群:654792529;如果您觉得本站非常有看点,那么赶紧使用Ctrl+D收藏吧!

CentOS 7.2 编译安装 MySQL 5.6.36

MySQL yvan 7年前 (2018-02-04) 6375次浏览 已收录 0个评论 扫描二维码

CentOS 7.2 编译安装 MySQL 5.6.36

环境说明:

1、系统:CentOS最小化安装;升级软件补丁,内核和系统版本不升级;关闭SELinux和防火墙。系统安装可参考
CentOS 7系统部署

IT运维网 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明CentO […]

2、软件:安装包统一放置在/usr/src目录下,安装位置统一在/usr/local目录下。
开始安装:

1、CentOS7默认安装了MariaDB数据库,首先将卸载掉。

[root@izuf6in4w20dqvk2nrs45kz ~]# rpm -qa | grep mariadb
mariadb-libs-5.5.56-2.el7.x86_64
[root@izuf6in4w20dqvk2nrs45kz ~]# rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64
[root@izuf6in4w20dqvk2nrs45kz ~]# rpm -qa | grep mariadb                          
[root@izuf6in4w20dqvk2nrs45kz ~]# 

2、YUM安装依赖包及所需的编译工具(cmake);不管有没有装过统一都安装下,避免有问题。

[root@izuf6in4w20dqvk2nrs45kz ~]# yum install -y make gcc-c++ cmake bison-devel ncurses-devel autoconf
Loaded plugins: fastestmirror
base                                                                                                                                 | 3.6 kB  00:00:00     
epel                                                                                                                                 | 4.7 kB  00:00:00     
extras                                                                                                                               | 3.4 kB  00:00:00     
updates                                                                                                                              | 3.4 kB  00:00:00     
(1/3): epel/x86_64/updateinfo                                                                                                        | 880 kB  00:00:00     
(2/3): updates/7/x86_64/primary_db                                                                                                   | 6.0 MB  00:00:00     
(3/3): epel/x86_64/primary_db                                                                                                        | 6.2 MB  00:00:00     
Loading mirror speeds from cached hostfile
Package 1:make-3.82-23.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package autoconf.noarch 0:2.69-11.el7 will be installed
--> Processing Dependency: perl(Data::Dumper) for package: autoconf-2.69-11.el7.noarch
---> Package bison-devel.x86_64 0:3.0.4-1.el7 will be installed
---> Package cmake.x86_64 0:2.8.12.2-2.el7 will be installed
--> Processing Dependency: libarchive.so.13()(64bit) for package: cmake-2.8.12.2-2.el7.x86_64
---> Package gcc-c++.x86_64 0:4.8.5-16.el7_4.1 will be installed
--> Processing Dependency: libstdc++-devel = 4.8.5-16.el7_4.1 for package: gcc-c++-4.8.5-16.el7_4.1.x86_64
---> Package ncurses-devel.x86_64 0:5.9-14.20130511.el7_4 will be installed
--> Running transaction check
---> Package libarchive.x86_64 0:3.1.2-10.el7_2 will be installed
---> Package libstdc++-devel.x86_64 0:4.8.5-16.el7_4.1 will be installed
---> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================
 Package                                 Arch                          Version                                         Repository                      Size
============================================================================================================================================================
Installing:
 autoconf                                noarch                        2.69-11.el7                                     base                           701 k
 bison-devel                             x86_64                        3.0.4-1.el7                                     base                            23 k
 cmake                                   x86_64                        2.8.12.2-2.el7                                  base                           7.1 M
 gcc-c++                                 x86_64                        4.8.5-16.el7_4.1                                updates                        7.2 M
 ncurses-devel                           x86_64                        5.9-14.20130511.el7_4                           updates                        712 k
Installing for dependencies:
 libarchive                              x86_64                        3.1.2-10.el7_2                                  base                           318 k
 libstdc++-devel                         x86_64                        4.8.5-16.el7_4.1                                updates                        1.5 M
 perl-Data-Dumper                        x86_64                        2.145-3.el7                                     base                            47 k

Transaction Summary
============================================================================================================================================================
Install  5 Packages (+3 Dependent packages)

Total download size: 17 M
Installed size: 56 M
Downloading packages:
(1/8): bison-devel-3.0.4-1.el7.x86_64.rpm                                                                                            |  23 kB  00:00:00     
(2/8): autoconf-2.69-11.el7.noarch.rpm                                                                                               | 701 kB  00:00:00     
(3/8): libarchive-3.1.2-10.el7_2.x86_64.rpm                                                                                          | 318 kB  00:00:00     
(4/8): gcc-c++-4.8.5-16.el7_4.1.x86_64.rpm                                                                                           | 7.2 MB  00:00:00     
(5/8): ncurses-devel-5.9-14.20130511.el7_4.x86_64.rpm                                                                                | 712 kB  00:00:00     
(6/8): libstdc++-devel-4.8.5-16.el7_4.1.x86_64.rpm                                                                                   | 1.5 MB  00:00:00     
(7/8): perl-Data-Dumper-2.145-3.el7.x86_64.rpm                                                                                       |  47 kB  00:00:00     
(8/8): cmake-2.8.12.2-2.el7.x86_64.rpm                                                                                               | 7.1 MB  00:00:00     
------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                        43 MB/s |  17 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows:
2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18()(64bit)
2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18(libmysqlclient_18)(64bit)
  Installing : libstdc++-devel-4.8.5-16.el7_4.1.x86_64                                                                                                  1/8 
  Installing : libarchive-3.1.2-10.el7_2.x86_64                                                                                                         2/8 
  Installing : perl-Data-Dumper-2.145-3.el7.x86_64                                                                                                      3/8 
  Installing : autoconf-2.69-11.el7.noarch                                                                                                              4/8 
  Installing : cmake-2.8.12.2-2.el7.x86_64                                                                                                              5/8 
  Installing : gcc-c++-4.8.5-16.el7_4.1.x86_64                                                                                                          6/8 
  Installing : bison-devel-3.0.4-1.el7.x86_64                                                                                                           7/8 
  Installing : ncurses-devel-5.9-14.20130511.el7_4.x86_64                                                                                               8/8 
  Verifying  : autoconf-2.69-11.el7.noarch                                                                                                              1/8 
  Verifying  : perl-Data-Dumper-2.145-3.el7.x86_64                                                                                                      2/8 
  Verifying  : libarchive-3.1.2-10.el7_2.x86_64                                                                                                         3/8 
  Verifying  : gcc-c++-4.8.5-16.el7_4.1.x86_64                                                                                                          4/8 
  Verifying  : cmake-2.8.12.2-2.el7.x86_64                                                                                                              5/8 
  Verifying  : ncurses-devel-5.9-14.20130511.el7_4.x86_64                                                                                               6/8 
  Verifying  : bison-devel-3.0.4-1.el7.x86_64                                                                                                           7/8 
  Verifying  : libstdc++-devel-4.8.5-16.el7_4.1.x86_64                                                                                                  8/8 

Installed:
  autoconf.noarch 0:2.69-11.el7                   bison-devel.x86_64 0:3.0.4-1.el7    cmake.x86_64 0:2.8.12.2-2.el7    gcc-c++.x86_64 0:4.8.5-16.el7_4.1   
  ncurses-devel.x86_64 0:5.9-14.20130511.el7_4   

Dependency Installed:
  libarchive.x86_64 0:3.1.2-10.el7_2              libstdc++-devel.x86_64 0:4.8.5-16.el7_4.1              perl-Data-Dumper.x86_64 0:2.145-3.el7             

Complete!

3、创建MySQL用户和组(用户属性为禁止登录及不创建家目录)

[root@izuf6in4w20dqvk2nrs45kz ~]# useradd -s /sbin/nologin -M mysql

4、进入软件包存放目录解压安装包并进入解压后的软件目录内

[root@izuf6in4w20dqvk2nrs45kz ~]# cd /usr/src/
[root@izuf6in4w20dqvk2nrs45kz src]# ll
total 31448
drwxr-xr-x. 2 root root     4096 Nov  5  2016 debug
drwxr-xr-x. 2 root root     4096 Nov  5  2016 kernels
-rw-r--r--  1 root root 32192348 Jan 25 10:30 mysql-5.6.36.tar.gz
[root@izuf6in4w20dqvk2nrs45kz src]# tar -zxf mysql-5.6.36.tar.gz 
[root@izuf6in4w20dqvk2nrs45kz src]# ll
total 31452
drwxr-xr-x.  2 root root      4096 Nov  5  2016 debug
drwxr-xr-x.  2 root root      4096 Nov  5  2016 kernels
drwxr-xr-x  33 7161 31415     4096 Mar 18  2017 mysql-5.6.36
-rw-r--r--   1 root root  32192348 Jan 25 10:30 mysql-5.6.36.tar.gz
[root@izuf6in4w20dqvk2nrs45kz src]# cd mysql-5.6.36
[root@izuf6in4w20dqvk2nrs45kz mysql-5.6.36]# ll
total 324
drwxr-xr-x  2 7161 31415  4096 Mar 18  2017 BUILD
drwxr-xr-x  2 7161 31415  4096 Mar 18  2017 client
drwxr-xr-x  4 7161 31415  4096 Mar 18  2017 cmake
-rw-r--r--  1 7161 31415 21864 Mar 18  2017 CMakeLists.txt
drwxr-xr-x  3 7161 31415  4096 Mar 18  2017 cmd-line-utils
-rw-r--r--  1 7161 31415 19838 Mar 18  2017 config.h.cmake
-rw-r--r--  1 7161 31415 40929 Mar 18  2017 configure.cmake
-rw-r--r--  1 7161 31415 17987 Mar 18  2017 COPYING
drwxr-xr-x  2 7161 31415  4096 Mar 18  2017 dbug
drwxr-xr-x  2 7161 31415  4096 Mar 18  2017 Docs
-rw-r--r--  1 7161 31415 65958 Mar 18  2017 Doxyfile-perfschema
drwxr-xr-x  3 7161 31415  4096 Mar 18  2017 extra
drwxr-xr-x  4 7161 31415  4096 Mar 18  2017 include
-rw-r--r--  1 7161 31415   333 Mar 18  2017 INSTALL
drwxr-xr-x  7 7161 31415  4096 Mar 18  2017 libevent
drwxr-xr-x  3 7161 31415  4096 Mar 18  2017 libmysql
drwxr-xr-x  3 7161 31415  4096 Mar 18  2017 libmysqld
drwxr-xr-x  2 7161 31415  4096 Mar 18  2017 libservices
drwxr-xr-x  2 7161 31415  4096 Mar 18  2017 man
drwxr-xr-x 10 7161 31415  4096 Mar 18  2017 mysql-test
drwxr-xr-x  2 7161 31415  4096 Mar 18  2017 mysys
drwxr-xr-x  2 7161 31415  4096 Mar 18  2017 mysys_ssl
drwxr-xr-x 17 7161 31415  4096 Mar 18  2017 packaging
drwxr-xr-x 11 7161 31415  4096 Mar 18  2017 plugin
-rw-r--r--  1 7161 31415  2496 Mar 18  2017 README
drwxr-xr-x  2 7161 31415  4096 Mar 18  2017 regex
drwxr-xr-x  2 7161 31415  4096 Mar 18  2017 scripts
drwxr-xr-x  4 7161 31415 20480 Mar 18  2017 sql
drwxr-xr-x  5 7161 31415  4096 Mar 18  2017 sql-bench
drwxr-xr-x  2 7161 31415  4096 Mar 18  2017 sql-common
drwxr-xr-x 13 7161 31415  4096 Mar 18  2017 storage
drwxr-xr-x  2 7161 31415  4096 Mar 18  2017 strings
drwxr-xr-x  5 7161 31415  4096 Mar 18  2017 support-files
drwxr-xr-x  2 7161 31415  4096 Mar 18  2017 tests
drwxr-xr-x  5 7161 31415  4096 Mar 18  2017 unittest
-rw-r--r--  1 7161 31415    88 Mar 18  2017 VERSION
drwxr-xr-x  3 7161 31415  4096 Mar 18  2017 vio
drwxr-xr-x  2 7161 31415  4096 Mar 18  2017 win
drwxr-xr-x  2 7161 31415  4096 Mar 18  2017 zlib

5、在安装包目录内,编译MySQL软件。
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.6.36 \
-DMYSQL_DATADIR=/usr/local/mysql-5.6.36/data \
-DSYSCONFDIR=/etc \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_READLINE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci

[root@izuf6in4w20dqvk2nrs45kz mysql-5.6.36]# cmake \
> -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.6.36 \
> -DMYSQL_DATADIR=/usr/local/mysql-5.6.36/data \
> -DSYSCONFDIR=/etc \
> -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
> -DWITH_MYISAM_STORAGE_ENGINE=1 \
> -DWITH_INNOBASE_STORAGE_ENGINE=1 \
> -DWITH_FEDERATED_STORAGE_ENGINE=1 \
> -DWITH_MEMORY_STORAGE_ENGINE=1 \
> -DENABLED_LOCAL_INFILE=1 \
> -DWITH_READLINE=1 \
> -DWITH_EMBEDDED_SERVER=1 \
> -DEXTRA_CHARSETS=all \
> -DDEFAULT_CHARSET=utf8 \
> -DDEFAULT_COLLATION=utf8_general_ci
-- Running cmake version 2.8.12.2
-- Could NOT find Git (missing:  GIT_EXECUTABLE) 
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- 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
-- MySQL 5.6.36
-- Packaging as: mysql-5.6.36-Linux-x86_64
-- Performing Test HAVE_LLVM_LIBCPP
......省略部分信息......
-- Performing Test HAVE_PEERCRED
-- Performing Test HAVE_PEERCRED - Success
-- Library mysqlclient depends on OSLIBS -lpthread;m;dl
-- Googletest was not found. gtest-based unit tests will be disabled. You can run cmake . -DENABLE_DOWNLOADS=1 to automatically download and build required components from source.
-- If you are inside a firewall, you may need to use an https proxy: export https_proxy=http://example.com:80
Warning: Bison executable not found in PATH
-- Library mysqlserver depends on OSLIBS -lpthread;m;crypt;dl
-- Skipping deb packaging on unsupported platform Core.
-- CMAKE_BUILD_TYPE: RelWithDebInfo
-- COMPILE_DEFINITIONS: HAVE_CONFIG_H
-- CMAKE_C_FLAGS:  -Wall -Wextra -Wformat-security -Wvla -Wwrite-strings -Wdeclaration-after-statement
-- CMAKE_CXX_FLAGS:  -Wall -Wextra -Wformat-security -Wvla -Woverloaded-virtual -Wno-unused-parameter
-- CMAKE_C_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- CMAKE_CXX_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    WITH_MEMORY_STORAGE_ENGINE
    WITH_READLINE


-- Build files have been written to: /usr/src/mysql-5.6.36

6、开始编译安装MySQL软件

[root@izuf6in4w20dqvk2nrs45kz mysql-5.6.36]# make && make install
Scanning dependencies of target INFO_BIN
[  0%] Built target INFO_BIN
Scanning dependencies of target INFO_SRC
[  0%] Built target INFO_SRC
Scanning dependencies of target abi_check
[  0%] Built target abi_check
Scanning dependencies of target zlib
[  0%] Building C object zlib/CMakeFiles/zlib.dir/adler32.c.o
[  0%] Building C object zlib/CMakeFiles/zlib.dir/compress.c.o
[  0%] Building C object zlib/CMakeFiles/zlib.dir/crc32.c.o
[  0%] Building C object zlib/CMakeFiles/zlib.dir/deflate.c.o
[  0%] Building C object zlib/CMakeFiles/zlib.dir/gzio.c.o
[  0%] Building C object zlib/CMakeFiles/zlib.dir/infback.c.o
[  0%] Building C object zlib/CMakeFiles/zlib.dir/inffast.c.o
[  0%] Building C object zlib/CMakeFiles/zlib.dir/inflate.c.o
[  0%] Building C object zlib/CMakeFiles/zlib.dir/inftrees.c.o
[  0%] Building C object zlib/CMakeFiles/zlib.dir/trees.c.o
[  0%] Building C object zlib/CMakeFiles/zlib.dir/uncompr.c.o
[  1%] Building C object zlib/CMakeFiles/zlib.dir/zutil.c.o
Linking C static library libzlib.a
[  1%] Built target zlib
Scanning dependencies of target yassl
[  1%] Building CXX object extra/yassl/CMakeFiles/yassl.dir/src/buffer.cpp.o
[  1%] Building CXX object extra/yassl/CMakeFiles/yassl.dir/src/cert_wrapper.cpp.o
......此处省略部分信息......
[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
[  0%] Built target INFO_BIN
[  0%] Built target INFO_SRC
[  0%] Built target abi_check
[  1%] Built target zlib
......此处省略部分信息......
[100%] Built target mysqltest_embedded
[100%] Built target my_safe_process
Install the project...
-- Install configuration: "RelWithDebInfo"
-- Installing: /usr/local/mysql-5.6.36/./COPYING
......此处省略部分信息......
-- Installing: /usr/local/mysql-5.6.36/sql-bench/innotest1a
-- Installing: /usr/local/mysql-5.6.36/sql-bench/innotest2

7、确认安装目录是否存在并创建软链接

[root@izuf6in4w20dqvk2nrs45kz mysql-5.6.36]# ll /usr/local/
total 52
drwxr-xr-x   5 root root 4096 Feb  3 22:12 aegis
drwxr-xr-x.  2 root root 4096 Nov  5  2016 bin
drwxr-xr-x  10 root root 4096 Feb  3 22:12 cloudmonitor
drwxr-xr-x.  2 root root 4096 Nov  5  2016 etc
drwxr-xr-x.  2 root root 4096 Nov  5  2016 games
drwxr-xr-x.  2 root root 4096 Nov  5  2016 include
drwxr-xr-x.  2 root root 4096 Nov  5  2016 lib
drwxr-xr-x.  2 root root 4096 Nov  5  2016 lib64
drwxr-xr-x.  2 root root 4096 Nov  5  2016 libexec
drwxr-xr-x  13 root root 4096 Feb  3 22:52 mysql-5.6.36
drwxr-xr-x.  2 root root 4096 Nov  5  2016 sbin
drwxr-xr-x.  6 root root 4096 Feb  1 10:38 share
drwxr-xr-x.  2 root root 4096 Nov  5  2016 src
[root@izuf6in4w20dqvk2nrs45kz mysql-5.6.36]# ln -s /usr/local/mysql-5.6.36/ /usr/local/mysql
[root@izuf6in4w20dqvk2nrs45kz mysql-5.6.36]# ll /usr/local/
total 52
drwxr-xr-x   5 root root 4096 Feb  3 22:12 aegis
drwxr-xr-x.  2 root root 4096 Nov  5  2016 bin
drwxr-xr-x  10 root root 4096 Feb  3 22:12 cloudmonitor
drwxr-xr-x.  2 root root 4096 Nov  5  2016 etc
drwxr-xr-x.  2 root root 4096 Nov  5  2016 games
drwxr-xr-x.  2 root root 4096 Nov  5  2016 include
drwxr-xr-x.  2 root root 4096 Nov  5  2016 lib
drwxr-xr-x.  2 root root 4096 Nov  5  2016 lib64
drwxr-xr-x.  2 root root 4096 Nov  5  2016 libexec
lrwxrwxrwx   1 root root   24 Feb  3 22:57 mysql -> /usr/local/mysql-5.6.36/
drwxr-xr-x  13 root root 4096 Feb  3 22:52 mysql-5.6.36
drwxr-xr-x.  2 root root 4096 Nov  5  2016 sbin
drwxr-xr-x.  6 root root 4096 Feb  1 10:38 share
drwxr-xr-x.  2 root root 4096 Nov  5  2016 src

8、设置MySQL目录属主和属组

[root@izuf6in4w20dqvk2nrs45kz mysql-5.6.36]# chown -R mysql.mysql /usr/local/mysql/

9、拷贝MySQL配置文件;如果有提示(cp: overwrite `/etc/my.cnf’?)按“y”确认。

[root@izuf6in4w20dqvk2nrs45kz mysql-5.6.36]# cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf

10、初始化MySQL软件,指明安装目录、数据库存放位置及授权给mysql用户。PS:看到两个OK就代表没问题

[root@izuf6in4w20dqvk2nrs45kz mysql-5.6.36]# /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --user=mysql
Installing MySQL system tables...2018-02-03 23:02:35 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-02-03 23:02:35 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2018-02-03 23:02:35 0 [Note] /usr/local/mysql//bin/mysqld (mysqld 5.6.36) starting as process 16390 ...
2018-02-03 23:02:35 16390 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-02-03 23:02:35 16390 [Note] InnoDB: The InnoDB memory heap is disabled
......此处省略部分信息......
2018-02-03 23:02:37 16390 [Note] InnoDB: Starting shutdown...
2018-02-03 23:02:38 16390 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK

Filling help tables...2018-02-03 23:02:38 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-02-03 23:02:38 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
2018-02-03 23:02:38 0 [Note] /usr/local/mysql//bin/mysqld (mysqld 5.6.36) starting as process 16412 ...
2018-02-03 23:02:38 16412 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-02-03 23:02:38 16412 [Note] InnoDB: The InnoDB memory heap is disabled
......此处省略部分信息......
2018-02-03 23:02:39 16412 [Note] InnoDB: Starting shutdown...
2018-02-03 23:02:40 16412 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

  /usr/local/mysql//bin/mysqladmin -u root password 'new-password'
  /usr/local/mysql//bin/mysqladmin -u root -h izuf6in4w20dqvk2nrs45kz password 'new-password'

Alternatively you can run:

  /usr/local/mysql//bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

  cd . ; /usr/local/mysql//bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

  cd mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

New default config file was created as /usr/local/mysql//my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings

WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server

11、拷贝MySQL服务脚本并赋予执行权限

[root@izuf6in4w20dqvk2nrs45kz mysql-5.6.36]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld && chmod +x /etc/init.d/mysqld

12、配置MySQL环境变量并重载环境变量

[root@izuf6in4w20dqvk2nrs45kz mysql-5.6.36]# echo 'export PATH=/usr/local/mysql/bin:$PATH' >>/etc/profile && source /etc/profile

13、将MySQL启动服务加入到系统服务并检查

[root@izuf6in4w20dqvk2nrs45kz mysql-5.6.36]# chkconfig --add mysqld
[root@izuf6in4w20dqvk2nrs45kz mysql-5.6.36]# chkconfig --list mysqld

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

      If you want to list systemd services use 'systemctl list-unit-files'.
      To see services enabled on particular target use
      'systemctl list-dependencies [target]'.

mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off

14、启动MySQL软件

[root@izuf6in4w20dqvk2nrs45kz mysql-5.6.36]# systemctl start mysqld

15、登录MySQL,此时登录密码为空,直接就可以登录进去。

[root@izuf6in4w20dqvk2nrs45kz mysql-5.6.36]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.36 Source distribution

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> 

初始化:

        默认安装后的MySQL用户root为空密码状态,存在匿名用户,存在测试数据库;利用/usr/local/mysql/bin目录下的mysql_secure_installation安全配置向导文件来初始化数据库

[root@izuf6in4w20dqvk2nrs45kz bin]# mysql_secure_installation 



NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): <–第一次运行因为用户root为空密码状态所以直接回车即可
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] <– 是否设置root用户密码,默认为“y”直接回车即可。
New password: <– 设置root用户的密码,密码不显示直接输入后回车即可。
Re-enter new password: <– 再输入一次你设置的密码回车即可
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] <– 是否删除匿名用户,生产环境建议删除,默认为“y”直接回车即可。
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] <–是否禁止root远程登录,根据自己的需求选择;禁止的话默认为“y”直接回车即可。
 ... skipping.

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] <– 是否删除test数据库,生产环境建议删除,默认为“y”直接回车即可。
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] <– 是否重新加载权限表,默认为“y”直接回车即可。
 ... Success!




All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


Cleaning up...

IT运维网 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明CentOS 7.2 编译安装 MySQL 5.6.36
喜欢 (5)
yvan
关于作者:
聪明来自勤奋、知识在于积累、好记性不如烂键盘!

您必须 登录 才能发表评论!