安装环境

  Linux(CentOS6.5 版)、boost_1_59_0.tar.gz、mysql-5.7.11.tar.gz

MySQL 5.7主要特性:

    更好的性能:对于多核CPU、固态硬盘、锁有着更好的优化,每秒100W QPS已不再是MySQL的追求,下个版本能否上200W QPS才是吾等用户更关心的
    更好的InnoDB存储引擎
    更为健壮的复制功能:复制带来了数据完全不丢失的方案,传统金融客户也可以选择使用MySQL数据库。此外,GTID在线平滑升级也变得可能
    更好的优化器:优化器代码重构的意义将在这个版本及以后的版本中带来巨大的改进,Oracle官方正在解决MySQL之前最大的难题
    原生JSON类型的支持
    更好的地理信息服务支持:InnoDB原生支持地理位置类型,支持GeoJSON,GeoHash特性
    新增sys库:以后这会是DBA访问最频繁的库

步骤一

创建mysql用户组及用户:
groupadd mysql
useradd -r -g mysql mysql

创建数据库相关目录:
mkdir -p /opt/usr/mysql/5.7.11
mkdir -p /opt/usr/mysql/5.7.11/mysqldata
chown -R mysql:mysql /opt/usr/mysql/5.7.11/

步骤二

解压
tar xzf boost_1_59_0.tar.gz
tar xzf mysql-5.7.11.tar.gz

预编译:

cmake \-DCMAKE_INSTALL_PREFIX=/opt/usr/mysql/5.7.11
-DMYSQL_DATADIR=/opt/usr/mysql/5.7.17/mysqldata  
-DSYSCONFDIR=/etc
-DWITH_MYISAM_STORAGE_ENGINE=1
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_MEMORY_STORAGE_ENGINE=1  
-DWITH_READLINE=1
-DWITH_ARCHIVE_STORAGE_ENGINE=1
-DWITH_PARTITION_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock
-DMYSQL_TCP_PORT=3306
-DENABLED_LOCAL_INFILE=1
-DEXTRA_CHARSETS=all
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci  
-DWITH_EMBEDDED_SERVER=1
-DWITH_LIBWRAP=0
-DWITH_BOOST=/tools/boost_1_59_0 (解压路径)

编译安装
marke
marke install
注意:如果需要重装mysql,在/home/software/mysql-5.7.11再执行下make install就可以了,不需要再cmake和make

修改目录拥有者
chown -R mysql:mysql /opt/usr/mysql/5.7.11/

提示错误,需要安装bison*

CMake Warning at cmake/bison.cmake:20 (MESSAGE):
  Bison executable not found in PATH
Call Stack (most recent call first):
  sql/CMakeLists.txt:514 (INCLUDE)

CMake Warning at cmake/bison.cmake:20 (MESSAGE):
  Bison executable not found in PATH
Call Stack (most recent call first):
  libmysqld/CMakeLists.txt:142 (INCLUDE)

yum -y install bison*

[root@tbwy02 mysql-5.7.11]# make
[root@tbwy02 mysql-5.7.11]# make install
[root@tbwy02 5.7.11]# pwd   
/opt/usr/mysql/5.7.11
5.7 以后 初始化数据

[root@tbwy02 5.7.11]# /opt/usr/mysql/5.7.11/bin/mysqld --initialize --basedir=/opt/usr/mysql/5.7.11/ --datadir=/opt/usr/mysql/5.7.11/mysqldata/ --user=mysql
[root@tbwy02 5.7.11]# pwd
/opt/usr/mysql/5.7.11
[root@tbwy02 5.7.11]# bin/mysqld --initialize --basedir=/opt/usr/mysql/5.7.11/ --datadir=/opt/usr/mysql/5.7.11/mysqldata/ --user=mysql
[root@tbwy02 5.7.11]# cp support-files/mysql.server /etc/init.d/mysqld
[root@tbwy02 5.7.11]# chmod +x /etc/init.d/mysqld
[root@tbwy02 5.7.11]# chkconfig --add mysqld
[root@tbwy02 5.7.11]# service mysqld start
Starting MySQL.                                            [  OK  ]
[root@tbwy02 5.7.11]# ps -ef |grep mysql
root     29916     1  0 21:55 pts/1    00:00:00 /bin/sh /opt/usr/mysql/5.7.11/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/tbwy02.pid
mysql    30088 29916  2 21:55 pts/1    00:00:00 /opt/usr/mysql/5.7.11/bin/mysqld --basedir=/opt/usr/mysql/5.7.11 --datadir=/var/lib/mysql --plugin-dir=/opt/usr/mysql/5.7.11/lib/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/lib/mysql/tbwy02.pid --socket=/var/lib/mysql/mysql.sock
root     30121 12930  0 21:55 pts/1    00:00:00 grep mysql

2017-6-29 10:36
[root@tbwy02 5.7.11]# pwd
/opt/usr/mysql/5.7.11
会在mysql目录内生成一个data目录,存放数据库的目录
[root@tbwy02 5.7.11]# bin/mysqld --initialize --basedir=/opt/usr/mysql/5.7.11/ --datadir=/opt/usr/mysql/5.7.11/mysqldata/ --user=mysql
返回结果最后一行的末尾有随机密码,我的记下来:al,q16OSkeh
2017-06-29T02:14:20.904715Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-06-29T02:14:21.614429Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-06-29T02:14:21.820184Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-06-29T02:14:21.925884Z 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: aa2d031f-5c70-11e7-a3f2-b8ca3af70415.
2017-06-29T02:14:21.941971Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-06-29T02:14:21.943214Z 1 [Note] A temporary password is generated for root@localhost: =al,q16OSkeh

想设置默认密码为空则将--initialize选项替换为--initialize-insecure选项
bin/mysqld --initialize-insecure --basedir=/opt/usr/mysql/5.7.11/ --datadir=/opt/usr/mysql/5.7.11/mysqldata/ --user=mysql
[root@tbwy02 5.7.11]# cat  /etc/my.cnf
[mysqld]
#datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock

# zkm 2017-6-29
datadir=/opt/usr/mysql/5.7.11/mysqldata/
socket=/usr/local/mysql/mysql.sock

user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@tbwy02 5.7.11]#

[root@tbwy02 5.7.11]# service mysqld stop
[root@tbwy02 5.7.11]# service mysqld restart

[root@tbwy02 5.7.11]# cd /opt/usr/mysql/5.7.11/mysqldata
[root@tbwy02 mysqldata]# rm -rf *

[root@tbwy02 5.7.11]# bin/mysqld --initialize-insecure --basedir=/opt/usr/mysql/5.7.11/ --datadir=/opt/usr/mysql/5.7.11/mysqldata/ --user=mysql
2017-06-29T02:32:26.314704Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-06-29T02:32:27.008945Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-06-29T02:32:27.209595Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-06-29T02:32:27.305079Z 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: 311cbbe4-5c73-11e7-b8f1-b8ca3af70415.
2017-06-29T02:32:27.322605Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-06-29T02:32:27.323494Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
[root@tbwy02 5.7.11]#
[root@tbwy02 5.7.11]# mysql -uroot -p
默认密码为空
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| cblsqldb           |
| mysql              |
| performance_schema |
| test               |
+--------------------+
5 rows in set (0.00 sec)

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

mysql> drop user 'zkm'@'%';
ERROR 1396 (HY000): Operation DROP USER failed for 'zkm'@'%'

解决方法:
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

创建用户:
mysql> create user 'tbwytest'@'%' identified by 'tbwytest123';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'tbwytest'@'%' IDENTIFIED BY 'tbwytest123' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

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

mysql> select user,host,password from mysql.user;
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
mysql> select user,host from mysql.user;
+-----------+-----------+
| user      | host      |
+-----------+-----------+
| tbwytest  | %         |
| mysql.sys | localhost |
| root      | localhost |
+-----------+-----------+
3 rows in set (0.00 sec)

mysql>

Centos6.5 源码编译安装 Mysql5.7.11及配置的更多相关文章

  1. centos6.5环境源码编译安装mysql5.6.34

    centos6.5环境源码编译安装mysql5.6.34 源码下载地址http://dev.mysql.com/downloads/mysql/5.6.html#downloads 选择Generic ...

  2. 源码编译安装mysql5.5.33

    源码编译安装mysql5.5.33 一.安装cmake编译工具 跨平台编译器 # yum install -y gcc* # yum install -y cmake 解决依赖关系 # yum ins ...

  3. CentOS7.5源码编译安装mysql5.7.29

    #查看系统版本 [root@ctos3 ~]# cat /etc/redhat-release CentOS Linux release (Core) #下载源码包,需要注意的是mysql5.7 编译 ...

  4. Dubbo入门到精通学习笔记(十九):MySQL源码编译安装、MySQL主从复制的配置

    文章目录 MySQL 源码编译安装(CentOS-6.6+MySQL-5.6) 一.服务器配置: 二.源码安装 MySQL5.6.26: MySQL主从复制的配置 环境 依赖课程 MySQL 主从复制 ...

  5. Linux源码编译安装MySQL5.7

    目录[-] 一.环境准备: 二.升级系统: 三.做一些准备工作(以下Linux命令均在su到root用户操作): 四.开始编译安装mysql-5.7.9: 一.环境准备: 我尝试过以下环境都是能成功的 ...

  6. ubuntu上源码编译安装mysql5.7.27

    一.查看操作系统环境和目录结构,并创建mysql用户和组,以及规划安装mysql所需要的目录. #cat /etc/issue 查看发行版本信息: #cat  /proc/version 查看正在运行 ...

  7. linux上源码编译安装mysql-5.6.28

    在 linux 上编译安装 mysql-.tar.gz http://www.mysql.com/ mysql下载地址: http://www.mysql.com/downloads/mysql/#d ...

  8. Mysql5.6 for Centos6.5源码编译安装

    ## 说明 不同服务器需要改变 server_id ,同一台机器上需要改变 port 1. 关闭防火墙[root@mysql ~]# service iptables status --查看防火墙状态 ...

  9. 源码编译安装MySQL-5.6/mysql-5.6.39------踩了无数坑,重装了十几次服务器才会的,不容易啊!

    1.切换到src目录 cd /usr/local/src/ 2. 下载mysql免编译二进制包 免编译的mysql二进制包5.6源码包: wget http://mirrors.163.com/mys ...

随机推荐

  1. iOS 发布证书提示 此证书的签发者无效 解决办法

    1. 打开钥匙串  查看发布证书 都是提示 此证书的签发者无效   解决办法 : 2. 到了 第 4 步骤 再去 查看 发布证书 就会 显示  此证书有效 3.  如果还不可以 就 把 Apple W ...

  2. Linux文件查看与查找命令

    cat  查看一个文件 -E: 显示行结束符$ -n: 对显示出的每一行进行编号 -A:显示所有控制符 -b:非空行编号 -s:压缩连续的空行成一行 -T:显示制表符 常用:cat -An /etc/ ...

  3. Centos6.5_x86上Oracle11g2 32位的安装与卸载以及相关问题汇总

    需要注意的问题: 1.Linux包括内核和要安装的oralce版本是否符合(这个在官方文档中有说明). 2.安装oracle一般会新建一个为oracle的账户,注意在安装的过程中的root和oracl ...

  4. MyBatis和Hibernate相比,优势在哪里?

    1.开发对比开发速度 hibernate的真正掌握要比Mybatis来得难些.Mybatis框架相对简单很容易上手,但也相对简陋些.个人觉得要用好Mybatis还是首先要先理解好Hibernate. ...

  5. 使用Git初始化项目

    1.在Git官网上点击New repository新建项目: 2.在本地新建一个同名文件: 3.打开git bash切换到新建的文件目录: 4.echo "# myprojectname&q ...

  6. Bitwise And Queries

    Bitwise And Queries Time limit: 1500 msMemory limit: 128 MB You are given QQ queries of the form a\ ...

  7. SpringMVC 3.2集成Spring Security 3.2集成mybaties

    目录结构如下

  8. Java反射机制剖析(四)-深度剖析动态代理原理及总结

    动态代理类原理(示例代码参见java反射机制剖析(三)) a)  理解上面的动态代理示例流程 a)  理解上面的动态代理示例流程 b)  代理接口实现类源代码剖析 咱们一起来剖析一下代理实现类($Pr ...

  9. org.hibernate.LazyInitializationException...no session or session was closed

    org.hibernate.LazyInitializationException:failed to lazily initialize a collection of role:cn.its.oa ...

  10. find命令之xargs,exec

    一,find命令之xargs: 在 使用 find命令的-exec选项处理匹配到的文件时, find命令将所有匹配到的文件一起传递给exec执行.但有些系统对能够传递给exec的命 令长度有限制,这样 ...