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 ...
随机推荐
- SSH小结
工作有一段时间了,经常用SSH登录远程机器,但对原理一直不是很了解,所以查阅了一些资料,写个小结. 一. SSH是什么? SSH的全称是Secure Shell, 是一种"用来在不安全的网络 ...
- [刷题]算法竞赛入门经典(第2版) 5-16/UVa212 - Use of Hospital Facilities
题意:模拟患者做手术. 其条件为:医院有Nop个手术室.准备手术室要Mop分钟,另有Nre个恢复用的床.准备每张床要Mre分钟,早上Ts点整医院开张,从手术室手术完毕转移到回复床要Mtr分钟.现在医院 ...
- Centos6.5安装memcached
1.检查libevent 首先检查系统中是否安装了libevent(Memcache用到了libevent这个库用于Socket的处理). # rpm -q libevent libevent-1.4 ...
- 学习spring前,先了解了解代理模式
什么是代理模式 举个例子,我是一个包租公,我现在想卖房,但是我不想麻烦,每天被电话骚扰,所以这个时候我找了楼下一个中介,让他帮我代理这些事,那么他自然有租房的方法.以后如果有人想租房,直接找中介就行了 ...
- C#RichTextBox种跳转到指定行
用这个方法,iCodeRowsID是要跳转的行号,rtb是RiCHTextBox控件名. 其中rtb.Lines.Length可获得最大行数 private void TrunRowsId(int i ...
- 2017年中国大学生程序设计竞赛-中南地区赛暨第八届湘潭市大学生计算机程序设计大赛题解&源码(A.高斯消元,D,模拟,E,前缀和,F,LCS,H,Prim算法,I,胡搞,J,树状数组)
A------------------------------------------------------------------------------------ 题目链接:http://20 ...
- JVM学习笔记二:JVM参数
所有线程共享的内存主要有两块:堆内存和方法区. 其中堆内存分为两块:新生代Young generation(Eden区.From Survivor区.To Survivor区).老年代Tenured ...
- Editplus配置java运行环境以及其他需求的简单设置
java配置 首先,打开"工具"(tools)选项,选择"配置自定义工具组"(英文版 是倒数第二个)然后按照上面第二幅图片来配置javac环境,其中命令一栏是j ...
- 改进Android语音对讲系统的方法
本文属于Android局域网内的语音对讲项目系列,<实时Android语音对讲系统架构>阐述了局域网内Android语音对讲功能的框架,本文在此基础上进行了优化,包括音频的录制.播放,通信 ...
- 我来谈谈PHP和JAVA的区别
这里的标题写的是谈谈PHP和JAVA的区别,其实是委婉的说法,其实别人是想听PHP好还是JAVA好!!! 从而从中找到存在感!!! 因为由于我是从多年的php开发转到java开发的.所以最,不时的有好 ...