1:安装前的准备工作

需要的软件:

boost_1_59_0.tar.gz,cmake-3.6.1.tar.gz,mysql-5.7.22.tar.gz

开始安装MySQL

2.1 检查cmake

[root@oracle cmake-3.6.1]# ./bootstrap && make && make install

2.2 开始编译安装mysql

创建用户和组

[root@oracle cmake-3.6.1]#groupadd mysql

[root@oracle cmake-3.6.1]#useradd -g mysql -s /sbin/nologin -M mysql

创建安装数据库的目录和数据存放目录

[root@oracle src]# mkdir mysql5
[root@oracle src]# mkdir mysql

2.2.1 解压数据库软件

[root@oracle src]# tar -xvf mysql-5.7.22.tar.gz

[root@oracle mysql-5.7.22]# cmake . -DCMAKE_INSTALL_PREFIX=/data/src/mysql -DMYSQL_DATADIR=/data/src/mysql5 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_TCP_PORT=3306 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=0

[root@oracle mysql-5.7.]# cmake . -DCMAKE_INSTALL_PREFIX=/data/src/mysql -DMYSQL_DATADIR=/data/src/mysql5 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE= -DMYSQL_TCP_PORT= -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=
-- Running cmake version 3.6.
-- Could NOT find Git (missing: GIT_EXECUTABLE)
-- Configuring with MAX_INDEXES = 64U
-- The C compiler identification is GNU 4.4.
-- The CXX compiler identification is GNU 4.4.
-- 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
-- Detecting C compile features
-- Detecting C compile features - 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMAKE_GENERATOR: Unix Makefiles
-- 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
-- Performing Test HAVE_C_SHIFT_OR_OPTIMIZATION_BUG
-- Performing Test HAVE_C_SHIFT_OR_OPTIMIZATION_BUG - Failed
-- Performing Test HAVE_CXX_SHIFT_OR_OPTIMIZATION_BUG
-- Performing Test HAVE_CXX_SHIFT_OR_OPTIMIZATION_BUG - Failed
-- Performing Test HAVE_C_FLOATING_POINT_FUSED_MADD
-- Performing Test HAVE_C_FLOATING_POINT_FUSED_MADD - Failed
-- Performing Test HAVE_CXX_FLOATING_POINT_FUSED_MADD
-- Performing Test HAVE_CXX_FLOATING_POINT_FUSED_MADD - Failed
-- Performing Test HAVE_C_FP_CONTRACT_FLAG
-- Performing Test HAVE_C_FP_CONTRACT_FLAG - Failed
-- Performing Test HAVE_CXX_FP_CONTRACT_FLAG
-- Performing Test HAVE_CXX_FP_CONTRACT_FLAG - Failed
-- MySQL 5.7.
-- Packaging as: mysql-5.7.-Linux-x86_64
-- Looked for boost/version.hpp in and
-- BOOST_INCLUDE_DIR BOOST_INCLUDE_DIR-NOTFOUND
-- LOCAL_BOOST_DIR
-- LOCAL_BOOST_ZIP
-- Could not find (the correct version of) boost.
-- MySQL currently requires boost_1_59_0 CMake Error at cmake/boost.cmake: (MESSAGE):
You can download it with -DDOWNLOAD_BOOST= -DWITH_BOOST=<directory> This CMake script will look for boost in <directory>. If it is not there,
it will download and unpack it (in that directory) for you. If you are inside a firewall, you may need to use an http proxy: export http_proxy=http://example.com:80 Call Stack (most recent call first):
cmake/boost.cmake: (COULD_NOT_FIND_BOOST)
CMakeLists.txt: (INCLUDE) -- Configuring incomplete, errors occurred!
See also "/data/src/mysql-5.7.22/CMakeFiles/CMakeOutput.log".
See also "/data/src/mysql-5.7.22/CMakeFiles/CMakeError.log

这个的解决方法是:

在/usr/local下创建一个名为boost的文件夹

  1. mkdir -p /usr/local/boost
  2. 把上面的名为boost_1_59_0.tar.gz的压缩包解压就可以了
  3. tar -xvf boost_1_59_0.tar.gz

继续CMAKE 这里要注意红色的部分

[root@oracle src]# cmake . -DCMAKE_INSTALL_PREFIX=/data/src/mysql -DMYSQL_DATADIR=/data/src/mysql5 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_TCP_PORT=3306 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DWITH_BOOST=/usr/local/boost -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=0  这是根据刚才按装的路径添加的

   sql/CMakeLists.txt:572 (INCLUDE)

 CMake Warning at cmake/bison.cmake:20 (MESSAGE):
Bison executable not found in PATH
Call Stack (most recent call first):
libmysqld/CMakeLists.txt:205 (INCLUDE) -- Library mysqlserver depends on OSLIBS -lpthread;m;rt;crypt;dl;aio
-- MERGE_CONVENIENCE_LIBRARIES TARGET mysqlserver
-- MERGE_CONVENIENCE_LIBRARIES LIBS dbug;strings;regex;mysys;mysys_ssl;vio;zlib;yassl;taocrypt;crypt;dl;archive_embedded;blackhole_embedded;csv_embedded;federated_embedded;heap_embedded;innobase_embedded;lz4_lib;myisam_embedded;myisammrg_embedded;partition_embedded;ngram_parser_embedded;sql_embedded
-- MERGE_CONVENIENCE_LIBRARIES MYLIBS dbug;strings;regex;mysys;mysys_ssl;vio;zlib;yassl;taocrypt;archive_embedded;blackhole_embedded;csv_embedded;federated_embedded;heap_embedded;innobase_embedded;lz4_lib;myisam_embedded;myisammrg_embedded;partition_embedded;ngram_parser_embedded;sql_embedded
-- library target mysqlserver debug_target /data/src/debug/archive_output_directory/libmysqld.a
-- INSTALL mysqlclient.pc lib/pkgconfig
-- Skipping deb packaging on unsupported platform .
-- CMAKE_BUILD_TYPE: RelWithDebInfo
-- COMPILE_DEFINITIONS: _GNU_SOURCE;_FILE_OFFSET_BITS=64;HAVE_CONFIG_H;HAVE_LIBEVENT1
-- 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_LINK_FLAGS:
-- CMAKE_CXX_LINK_FLAGS:
-- 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
-- Build files have been written to: /data/src/mysql-5.7.22

看到上面的信息就证明cmake 成功了

2.2.2

[root@oracle mysql-5.7.22]# make && make install

把配置文件拷贝到/etc 下

通过上面的截图我们不难发现 没有我们要找的配置文件,难道5.7.22版本不需要配置文件了吗,我们先不管,接着往下做

[root@oracle mysql-5.7.22]# cp support-files/mysql.server /etc/init.d/mysqld

[root@oracle mysql-5.7.22]# chmod +x /etc/init.d/mysqld
[root@oracle mysql-5.7.22]# chkconfig --add mysqld

初始化MySQL数据库

注:在5.7.22版本中mysql_install_db 被废弃了,取而代之的是 mysqld –initialize

[root@oracle mysql]# bin/mysqld --initialize-insecure --user=mysql --basedir=/data/src/mysql/ --datadir=/data/src/mysql5
2018-05-24T07:07:55.314350Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-05-24T07:07:56.262284Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-05-24T07:07:56.407878Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-05-24T07:07:56.494757Z 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: 2f2eaae3-5f21-11e8-ab77-000c29e94efc.
2018-05-24T07:07:56.497669Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-05-24T07:07:56.512801Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.

注:这些警告信息不用管,只要没有error 就可以
2.2.3 我们尝试启动MySQL服务

[root@oracle mysql]# /etc/init.d/mysqld start
Starting MySQL.Logging to '/data/src/mysql5/oracle.err'.
SUCCESS!

数据库启动成功,因此 MySQL.5.7.22版本没有配置文件也是可以的。

[root@oracle mysql5]# echo '/data/src/mysql/include/' >> /etc/ld.so.conf
[root@oracle mysql5]# echo '/data/src/mysql/lib/' >> /etc/ld.so.conf

[root@oracle mysql5]# ldconfig

2.2.4 施工后校验,这里是没有初始化用户的

这个比5.6的版本多了sys 库少了test

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)

mysql> update mysql.user set authentication_string=password('m2i3sc') where user='root' ;
Query OK, 1 row affected, 1 warning (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 1

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
[root@oracle mysql5]# mysql -uroot -pm2i3sc
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.22 Source distribution

Copyright (c) 2000, 2018, 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> exit
Bye
[root@oracle mysql5]# mysqladmin -u root password 'm2i3sc'
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'

我们现在看一下每个schema的文件和之前有什么不同

[root@oracle mysql5]# ls
auto.cnf ib_buffer_pool ibdata1 ib_logfile0 ib_logfile1 ibtmp1 lhh mysql oracle.err oracle.pid performance_schema sys
[root@oracle mysql5]# cd lhh
[root@oracle lhh]# ls
db.opt emp.frm emp.ibd test.frm test.ibd
[root@oracle lhh]#

注意上面标记的红色的部分,这个在以前的5.6的版本中是没有这个文件的,存的表的结构,它所有的数据存在ibdata1 的这个文件中,这也是5.7版本的新特性。

至此,mysql-5.7.22版本的安装就算完成了。

MySQL5.7.22版本的安装和调试的更多相关文章

  1. Mysql5.7.22版本,插入中文乱码的问题

    首先,mysql5.7.22版本的免安装版本的,需要自己配置信息,而且容易出现问题,这里还是建议下载安装版本.msi,按照安装教程进行安装:安装成功后会在数据存储的data文件下找到参数配置文件my. ...

  2. 升级MySQL5.7.22版本_总结记录

    目录 一. mysql5.7安装 0. 背景 1. 准备:下载安装包 2. 安装流程小结 3. 具体步骤 二. mysql5.7的一些变化 一. mysql5.7安装 0. 背景 之前用的5.6版本, ...

  3. mysql5.7.22的安装与配置(适用mysql5.7.20至mysql5.7.22版本)

    一.解压Mysql5.7.20安装包,刚解压是没有  data  这个文件夹的 二.配置mysql环境变量,创建MYSQL_HOME,然后在Path上添加%MYSQL_HOME%\bin; 三.配置m ...

  4. MySQL5.7.19版本压缩包安装方式的一些坑

    ySQL社区版下载地址:https://dev.mysql.com/downloads/mysql/,在这里也可以选择之前的版本下载. MySQL进入5.7.7版本以后,压缩包安装需要注意一些地方: ...

  5. mysql5.7.22 zip 版安装

    2.将zip文件解压到本地,本文解压到如下目录:D:\softwares\mysql-5.7.14-winx64 3.新建一个配置文件(my.ini)用于配置字符集.端口等信息,用以覆盖原始的配置文件 ...

  6. TensorFlow GPU版本的安装与调试

    笔者采用python3.6.7+TensorFlow1.12.0+CUDA10.0+CUDNN7.3.1构建环境 PC端配置为GTX 1050+Intel i7 7700HQ 4核心8线程@2.8GH ...

  7. MySQL5.5多实例编译安装——多配置文件

    一.什么是MySQL多实例?MySQL多实例简单的说就是在一台服务器上安装一套MySQL程序,通过不同的端口对外提供访问,多实例不仅节省物理主机成本,还有效提升了单台物理主机的CPU.磁盘I/O使用效 ...

  8. mysql-5.6.22的安装步骤

    一.环境与下载地址: 1.系统下载地址: http://mirrors.sohu.com/centos/6.6/isos/x86_64/CentOS-6.6-x86_64-bin-DVD1.iso 2 ...

  9. [转]MySQL5.6.22 安装

    原文路径 http://jifeng3321.iteye.com/blog/2181517?utm_source=tuicool   由于一直做银行项目,所以一直在用oracle和db2,但最近自己想 ...

随机推荐

  1. 使用CALayer制作View的辉光效果

    使用CALayer制作View的辉光效果 实现以下的辉光效果: 思路是这样子的: 1. 创建好需要实现辉光效果的View 2. 对这个View进行截图 3. 将这个截图重新添加进View中 4. 对这 ...

  2. Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.

    System.Data.OracleClient 已经过时了.微软不再支持它. 因此,我建议你为. NET 使用Oracle数据提供程序:ODP.Net. 你可以从以下位置下载: 版本:Release ...

  3. Visual Studio Code (vscode)编译C++

    Visual Studio Code (简称 VS Code / VSC) 是一款免费开源的现代化轻量级代码编辑器,支持几乎所有主流的开发语言的语法高亮.智能代码补全.自定义热键.括号匹配.代码片段. ...

  4. August 29th 2017 Week 35th Tuesday

    Life is a pure flame, and we live by an invisible sun within us. 生命如纯洁的火焰,而维系这火焰的是我们内心的太阳. Burn my l ...

  5. UVA-1152-4 Values whose Sum is 0---中途相遇法

    题目链接: https://cn.vjudge.net/problem/UVA-1152 题目大意: 给出4个数组,每个数组有n个数,问有多少种方案在每个数组中选一个数,使得四个数相加为0. n &l ...

  6. python虚拟环境virtualenv高级篇

    我曾经写过一篇virtualenv的博客:http://www.cnblogs.com/anpengapple/p/5907416.html 总体来讲还是适用的,不过稍微傻了一点.这一篇的内容有两个: ...

  7. [emerg]: getpwnam(“nginx”) failed

    [root@localhost nginx-1.11.2]# /usr/local/nginx/sbin/nginx nginx: [emerg] getpwnam("nginx" ...

  8. 理解numpy dot函数

    python代码 x = np.array([[1,3],[1,4]]) y = np.array([[2,2],[3,1]]) print np.dot(x,y) 结果 [[11 5] [14 6] ...

  9. 记2019年目标之一没有996的大数据分析BI实战历程

    本文略长,阅读大约需要10分钟. 懵懵懂懂的学习了python,然后一发不可收拾的爱上了python大数据分析,慢慢的走进了大数据的学堂,学习如何大数据挖掘,大数据分析,到BI系统建设使用. 大数据的 ...

  10. log4j与logback包冲突原因及解决,不可忽视的Warning

    场景 一个简单的spring-boot程序,需要用kafka做消息队列,于是在maven中引入kafka依赖,一切看似没问题,在启动时,打印出Warning信息: SLF4J: Class path ...