Centos6.5 源码编译安装 Mysql5.7.11及配置
安装环境
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及配置的更多相关文章
- centos6.5环境源码编译安装mysql5.6.34
centos6.5环境源码编译安装mysql5.6.34 源码下载地址http://dev.mysql.com/downloads/mysql/5.6.html#downloads 选择Generic ...
- 源码编译安装mysql5.5.33
源码编译安装mysql5.5.33 一.安装cmake编译工具 跨平台编译器 # yum install -y gcc* # yum install -y cmake 解决依赖关系 # yum ins ...
- CentOS7.5源码编译安装mysql5.7.29
#查看系统版本 [root@ctos3 ~]# cat /etc/redhat-release CentOS Linux release (Core) #下载源码包,需要注意的是mysql5.7 编译 ...
- Dubbo入门到精通学习笔记(十九):MySQL源码编译安装、MySQL主从复制的配置
文章目录 MySQL 源码编译安装(CentOS-6.6+MySQL-5.6) 一.服务器配置: 二.源码安装 MySQL5.6.26: MySQL主从复制的配置 环境 依赖课程 MySQL 主从复制 ...
- Linux源码编译安装MySQL5.7
目录[-] 一.环境准备: 二.升级系统: 三.做一些准备工作(以下Linux命令均在su到root用户操作): 四.开始编译安装mysql-5.7.9: 一.环境准备: 我尝试过以下环境都是能成功的 ...
- ubuntu上源码编译安装mysql5.7.27
一.查看操作系统环境和目录结构,并创建mysql用户和组,以及规划安装mysql所需要的目录. #cat /etc/issue 查看发行版本信息: #cat /proc/version 查看正在运行 ...
- linux上源码编译安装mysql-5.6.28
在 linux 上编译安装 mysql-.tar.gz http://www.mysql.com/ mysql下载地址: http://www.mysql.com/downloads/mysql/#d ...
- Mysql5.6 for Centos6.5源码编译安装
## 说明 不同服务器需要改变 server_id ,同一台机器上需要改变 port 1. 关闭防火墙[root@mysql ~]# service iptables status --查看防火墙状态 ...
- 源码编译安装MySQL-5.6/mysql-5.6.39------踩了无数坑,重装了十几次服务器才会的,不容易啊!
1.切换到src目录 cd /usr/local/src/ 2. 下载mysql免编译二进制包 免编译的mysql二进制包5.6源码包: wget http://mirrors.163.com/mys ...
随机推荐
- Jdk1.6 JUC源码解析(7)-locks-ReentrantLock
功能简介: Java代码层面提供的锁机制,可做为Synchronized(jvm内置)的替代物,和Synchronized一样都是可重入的. 与Synchronized相比较而言,ReentrantL ...
- 使用Java语言开发微信公众平台(七)——音乐消息的回复
在上一节课程中,我们学习了图片消息的回复功能.根据微信公众平台的消息类型显示,微信共支持文本.图片.语音.视频.音乐.图文等6种消息类型的回复: 其中,我们已经实现了文本.图文.图片等消息的回复处理, ...
- Arduino UNO +ESP8266采集数据上传到贝壳网
集成电路设计大赛赛程将至,我现在还是毫无头绪,然后又报了一个互联网+,比赛报了,东西就必须出来,时间很紧的情况下,所以选择了开源的arduino的进行完成.从开始接触Arduino到完成工程,前前后后 ...
- swift 可选类型(optional)
可选类型定义 Swift 标准库中定义后缀 ?为可选类型 Optional<Wrapped> 的语法糖,这里语法糖可以简单理解为一种便捷的书写语法.也就是说,下面两个声明是等价的: va ...
- Error:Android Source Generator: [sdk] Android SDK is not specified.
有时候使用intellij idea 带入android 项目,运行提示Error:Android Source Generator: [sdk] Android SDK is not specifi ...
- netsh & winsock & 对前端的影响
netsh 与 winsock 一个是window的脚本工具,另一个则是window是网络编程中要用到的网络接口,而非要说跟我小小的前端有什么影响,那还真有...,当然这个影响是很不好的,比如node ...
- Mac电脑如何搭建php环境,并且开发php.
这篇文章主要介绍了Mac下搭建php开发环境教程,Mac OS X 内置了Apache 和 PHP,这样使用起来非常方便.本文以Mac OS X 10.12.4为例,需要的朋友可以参考下! Mac O ...
- Java学习笔记——MySQL开放3306接口与设置用户权限
系统Ubuntu16.04 LTS 1.开放3306端口查看端口状态:netstat -an|grep 3306tcp 0 0 127.0.0.1:3306 ...
- 深入理解Java常用类-----StringBuilder
上篇文章我们介绍过String这个常用类,知道了该类的内部其实是用的一个char数组表示一个字符串对象的,只是该字符数组被final修饰,一旦初始化就不能修改,但是对于经常做字符串修改操作的情况下,S ...
- Vue2.0 全家桶开发的网页应用(参照吾记APP)
github链接 借鉴吾记APP,使用 vue2.0+vue-router+vuex 为主要技术栈,elementui做为ui框架,多模块 spa 模式,webpack2.0 负责模块打包,gulp ...