源码编译安装MySQL 5.7.9
安装CentOS 6.3
配置yum:
[root@hank-yoon ~]# cd /etc/yum.repos.d/
[root@hank-yoon yum.repos.d]# mkdir a
[root@hank-yoon yum.repos.d]# ls
a  CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo  CentOS-Vault.repo
[root@hank-yoon yum.repos.d]# mv CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Vault.repo a
[root@hank-yoon yum.repos.d]# ls
a  CentOS-Media.repo
[root@hank-yoon yum.repos.d]# vi CentOS-Media.repo 
# CentOS-Media.repo
#
# This repo is used to mount the default locations for a CDROM / DVD on
#  CentOS-6.  You can use this repo and yum to install items directly off the
#  DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
#  yum --enablerepo=c6-media [command]
#
# or for ONLY the media repo, do this:
#
#  yum --disablerepo=\* --enablerepo=c6-media [command]
[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
#        file:///media/cdrom/
#        file:///media/cdrecorder/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
安装依赖的包:
[root@hank-yoon yum.repos.d]# yum install -y ncurses-devel glibc gcc gcc-c++ libstdc++*  libtool cmake lrzsz libaio-devel
上传源码安装包mysql-5.7.9.tar.gz和cmake-2.8.3.tar.gz:
[root@hank-yoon yum.repos.d]# cd /export/servers/
[root@hank-yoon servers]# ls
cmake-2.8.3.tar.gz  mysql-5.7.9.tar.gz
[root@hank-yoon servers]# tar -xvf cmake-2.8.3.tar.gz
[root@hank-yoon servers]# tar -xvf mysql-5.7.9.tar.gz
[root@hank-yoon servers]# ls
cmake-2.8.3  cmake-2.8.3.tar.gz  mysql-5.7.9  mysql-5.7.9.tar.gz
[root@hank-yoon servers]# cd cmake-2.8.3
[root@hank-yoon cmake-2.8.3]# ls
bootstrap         CMakeCPack.cmake            CMakeLogo.gif             Copyright.txt         DartConfig.cmake   Example     Templates
ChangeLog.manual  CMakeCPackOptions.cmake.in  cmake_uninstall.cmake.in  CTestConfig.cmake     DartLocal.conf.in  Modules     Tests
ChangeLog.txt     CMakeGraphVizOptions.cmake  CompileFlags.cmake        CTestCustom.cmake.in  Docs               Readme.txt  Utilities
cmake.1           CMakeLists.txt              configure                 CTestCustom.ctest.in  doxygen.config     Source
[root@hank-yoon cmake-2.8.3]# ./configure
[root@hank-yoon cmake-2.8.3]# make && make install
[root@hank-yoon mysql]# groupadd mysql
[root@hank-yoon mysql]# useradd -r -g mysql mysql
[root@hank-yoon export]# chown -R mysql.mysql /export/
[root@hank-yoon export]# mkdir -p data/mysql/data log tmp log dumps
编译MySQL安装包报错:
CMake Error at cmake/boost.cmake:76 (MESSAGE):
  You can download it with -DDOWNLOAD_BOOST=1 -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:228 (COULD_NOT_FIND_BOOST)
  CMakeLists.txt:435 (INCLUDE)
-- Configuring incomplete, errors occurred!
下载安装:wget http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
[root@hank-yoon export]# tar -xvf  boost_1_59_0.tar.gz
[root@hank-yoon boost_1_59_0]# ls
boost            boostcpp.jam  boost.png      bootstrap.sh  index.htm   INSTALL  libs             more     status
boost-build.jam  boost.css     bootstrap.bat  doc           index.html  Jamroot  LICENSE_1_0.txt  rst.css  tools
[root@hank-yoon mysql-5.7.9]# pwd
/export/mysql-5.7.9
[root@hank-yoon mysql-5.7.9]# cmake . -DCMAKE_INSTALL_PREFIX=/export/servers/mysql/ -DMYSQL_DATADIR=/export/data/mysql/data -DSYSCONFDIR=/export/servers/mysql/etc -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_UNIX_ADDR=/export/data/mysql/tmp/mysql.sock -DENABLED_LOCAL_INFILE=ON -DENABLED_PROFILING=ON -DWITH_DEBUG=0 -DENABLE_DTRACE=OFF -DMYSQL_TCP_PORT=3306 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/export/boost_1_59_0
-DCMAKE_INSTALL_PREFIX:指定MySQL程序的安装目录,默认/usr/local/mysql
-DMYSQL_DATADIR:数据文件目录
-DSYSCONFDIR:初始化参数文件目录
-DWITH_INNOBASE_STORAGE_ENGINE:指定静态编译到MySQL存储引擎
-DDEFAULT_CHARSET:默认字符集
-DMYSQL_TCP_PORT:默认端口
[root@hank-yoon mysql-5.7.9]# make && make install
[root@hank-yoon bin]# pwd
/export/servers/mysql/bin
初始化数据库:
[root@hank-yoon bin]# ./mysqld --initialize-insecure --user=mysql --basedir=/export/servers/mysql --datadir=/export/data/mysql/data
删除默认的my.cnf文件:
[root@hank-yoon bin]# rm -rf /etc/my.cnf
[root@hank-yoon bin]# ./mysqld_safe --defaults-file=/export/servers/mysql/etc/my.cnf &
新建配置文件my.cnf内容:
[root@hank-yoon etc]# cat my.cnf
[client]
port            = 3358
socket          = /export/data/mysql/tmp/mysql.sock
[mysqld]
port            = 3358
socket          = /export/data/mysql/tmp/mysql.sock
datadir         = /export/data/mysql/data/
#--- GLOBAL ---#
character-set-server    = utf8
lower_case_table_names  = 1
log-output              = FILE
log-error               = /export/data/mysql/log/error.log
general_log = 0
general_log_file        = /export/data/mysql/log/mysql.log
pid-file                = /export/data/mysql/mysql.pid
slow-query-log
slow_query_log_file     = /export/data/mysql/log/slow.log
tmpdir                  = /export/data/mysql/tmp
long_query_time         = 1
#--------------#
#thread_concurrency      = 16
thread_cache_size       = 512
table_open_cache        = 16384
table_definition_cache  = 16384
sort_buffer_size        = 2M
join_buffer_size        = 2M
read_buffer_size        = 4M
read_rnd_buffer_size    = 4M
key_buffer_size         = 8M
myisam_sort_buffer_size = 8M
tmp_table_size          = 64M
max_heap_table_size     = 64M
open_files_limit        = 65535
query_cache_size       = 0
#add z #################
innodb_undo_directory = /export/data/mysql/undo
innodb_undo_tablespaces = 4
explicit_defaults_for_timestamp = 1
#--- NETWORK ---#
back_log                = 1024
max_allowed_packet      = 16M
interactive_timeout     = 28800
wait_timeout            = 28800
skip-external-locking
max-connections         = 1000
skip-name-resolve
#read_only               = 1
#--- REPL ---#
server-id               = 360360
log-bin                 = mysql-bin
binlog_format           = mixed
expire_logs_days        = 7
relay-log               = relay-log
replicate-ignore-db     = mysql.slave_master_info
replicate-ignore-db     = mysql.slave_relay_log_info
replicate-ignore-db     = mysql.slave_worker_info
replicate-ignore-db     = test
replicate-ignore-db     = information_schema
replicate-ignore-db     = performance_schema
log_slave_updates
skip-slave-start
slave-parallel-workers= 4
sync_master_info	= 1
sync_relay_log	= 1
sync_relay_log_info	= 1
relay_log_info_repository	= TABLE
master_info_repository	= TABLE
#rpl_semi_sync_master_enabled	= 1
#rpl_semi_sync_slave_enabled	= 1
#rpl_semi_sync_master_timeout	= 1000
#--- INNODB ---#
default-storage-engine          = INNODB
innodb_data_home_dir            = /export/data/mysql/data
innodb_file_per_table
innodb_log_group_home_dir       = /export/data/mysql/data
innodb_log_files_in_group       = 3
innodb_log_file_size            = 512M
innodb_log_buffer_size          = 16M
innodb_flush_log_at_trx_commit  = 1
innodb_lock_wait_timeout        = 120
innodb_flush_method             = O_DIRECT
innodb_max_dirty_pages_pct      = 75
#change z #####
sync_binlog	= 1
innodb_buffer_pool_size         = 1G
innodb_data_file_path           = ibdata1:2G;ibdata2:2G:autoextend
innodb_autoextend_increment     = 500
innodb_thread_concurrency       = 32
innodb_open_files               = 65535
innodb_write_io_threads	= 20
innodb_read_io_threads	= 20
innodb_spin_wait_delay	= 10
innodb_flush_neighbors	= 1
innodb_use_native_aio = 1
innodb_io_capacity              = 2000
innodb_io_capacity_max          = 6000
relay_log_recovery	= 1
#innodb_additional_mem_pool_size = 128M
#change h #####
#innodb_numa_interleave=ON
innodb_lru_scan_depth=512
innodb_checksum_algorithm=crc32
innodb_purge_threads=4
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
# auto-rehash
# Remove the next comment character if you are not familiar with SQL
# safe-updates
default-character-set=utf8
[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
[root@hank-yoon log]# ps -ef | grep mysql
root     26374 10192  0 16:53 pts/1    00:00:00 /bin/sh ./mysqld_safe --defaults-file=/export/servers/mysql/etc/my.cnf
mysql    27460 26374  0 16:53 pts/1    00:00:04 /export/servers/mysql/bin/mysqld --defaults-file=/export/servers/mysql/etc/my.cnf --basedir=/export/servers/mysql --datadir=/export/data/mysql/data/ --plugin-dir=/export/servers/mysql/lib/plugin --user=mysql --log-error=/export/data/mysql/log/error.log --open-files-limit=65535 --pid-file=/export/data/mysql/mysql.pid --socket=/export/data/mysql/tmp/mysql.sock --port=3358
通过新配置文件重新初始化,不需要新的密码:(默认生成一个随机密码(~/.mysql_secret)
[root@hank-yoon bin]# ./mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.9-log Source distribution
Copyright (c) 2000, 2015, 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> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)
添加变量位置,在任意目录下执行mysql命令:
[root@hank-yoon ~]# vi .bash_profile
PATH=$PATH:$HOME/bin:/export/servers/mysql/bin:/export/servers/mysql/bin
export PATH
export LANG=en_US.UTF-8
[root@hank-yoon ~]# source .bash_profile
[root@hank-yoon ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.9-log Source distribution
Copyright (c) 2000, 2015, 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>
配置通过service启动mysql命令脚本:
[root@hank-yoon support-files]# pwd
/export/mysql-5.7.9/support-files
[root@hank-yoon support-files]# cp mysql.server /etc/init.d/mysqld
[root@hank-yoon init.d]# chmod 755 mysqld
[root@hank-yoon init.d]# service mysqld start
Starting MySQL.. SUCCESS!
[root@hank-yoon init.d]# service mysqld stop
Shutting down MySQL.. SUCCESS!
在自启动项中添加mysqld服务器:
[root@hank-yoon ~]# chkconfig --list mysqld
service mysqld supports chkconfig, but is not referenced in any runlevel (run 'chkconfig --add mysqld')
[root@hank-yoon ~]# chkconfig --add mysqld
[root@hank-yoon ~]# chkconfig --level 345 mysqld on
源码编译安装MySQL 5.7.9的更多相关文章
- CentOS源码编译安装MySQL 5.5.15
		
CentOS源码编译安装MySQL 5.5.15 文章目录 [隐藏] 安装编译工具 下载源码 安装cmake和bison 编译安装MySQL 一些相关设置 安装编译工具 yum install g ...
 - CentOS 6.6 下源码编译安装MySQL 5.7.5
		
版权声明:转自:http://www.linuxidc.com/Linux/2015-08/121667.htm 说明:CentOS 6.6 下源码编译安装MySQL 5.7.5 1. 安装相关工具# ...
 - Shell脚本一键部署——源码编译安装MySQL及自动补全工具
		
Shell脚本一键部署--源码编译安装MySQL及自动补全工具 编译安装MySQL 1.软件包 Mysql安装包 将安装包拖至/opt目录下,编辑一个脚本文件,将以下内容复制进去,然后source或者 ...
 - 源码编译安装 MySQL 5.5.x 实践
		
1.安装cmakeMySQL从5.5版本开始,通过./configure进行编译配置方式已经被取消,取而代之的是cmake工具.因此,我们首先要在系统中源码编译安装cmake工具. # wget ht ...
 - 总结源码编译安装mysql
		
最近在学习源码编译安装LAMP.LNMP时,一直遇到一个难题,就是就是mysql无论怎么源码编译安装,到最后启动服务都提示"Starting MySQL.The server quit wi ...
 - 源码编译安装 MySQL 5.5.x 实践(转)
		
1.安装cmakeMySQL从5.5版本开始,通过./configure进行编译配置方式已经被取消,取而代之的是cmake工具.因此,我们首先要在系统中源码编译安装cmake工具. # wget ht ...
 - CentOS 7 源码编译安装MySQL 5.7.14
		
一.添加用户和组 1. 进入root: su 2. 添加组: groupadd mysql 3. 添加用户: useradd -r -g mysql -s /bin/false mysql 二.安装 ...
 - 树莓派开发笔记(十五):树莓派4B+从源码编译安装mysql数据库
		
前言 树莓派使用数据库时,优先选择sqlite数据库,但是sqlite是文件数据库同时仅针对于单用户的情况,考虑到多用户的情况,在树莓派上部署安装mysql服务,通过读写锁事务等使用,可以实现多进 ...
 - 源码编译安装mysql
		
1 概述 首先来看下mysql的下载地址: http://ftp.plusline.de/mysql/Downloads/ 这里有mysql的各种版本 操作系统:CentOS releas ...
 
随机推荐
- Java内存管理的9个小技巧
			
Java内存管理的9个小技巧很多人都说“Java完了,只等着衰亡吧!”,为什么呢?最简单的的例子就是Java做的系统时非常占内存!一听到这样的话,一定会有不少人站出来为Java辩护,并举出一堆的性能测 ...
 - Oracle基础(九) Oracle的体系结构
			
一.Oracle体系结构概述: Oracle的体系结构是指数据库的组成.工作过程与原理,以及数据在数据库中的组织与管理机制.要了解Oracle数据库的体系结构,必须理解Oracle系统的重要概念和主要 ...
 - php的一些简单算法程序(冒泡、快速等)
			
冒泡排序: function buttle_sort($array) { $len=count($array); if($len<2){ return $array; } for($i=0;$i ...
 - hdu 3652 打表
			
思路:直接打表 #include<cstdio> #include<vector> #include<cmath> #include<iostream> ...
 - 转:  在线office的协作工具列表
			
产品完备性.协作功能.功能完备性对比 <img src="https://pic2.zhimg.com/af14a86eedcb93962e41e47788de5989_b.p ...
 - python实现发送邮件功能
			
'''套接字是为特定的网络协议(例如TCP/IP,ICMP/IP,UDP/IP等),允许程序和接受并进行连接,要在python 中建立具有TCP和流套接字的简单服务器,需要使用socket模块,利用该 ...
 - Web 网页常见问题集锦
			
1.如何去掉Chrome记住密码后自动填充表单的黄色背景 不知道大家有没有这样的烦恼,在Chrome浏览器中,记住密码后重新填写表单数据时,自动会有黄色背景的出现.(如图a) 图a 而出现这个黄色背景 ...
 - 结合setTimeout和clearTimeout,实现“返回顶部”的功能
			
结合setTimeout和clearTimeout,当页面停止滚动时,“返回顶部”按钮淡隐淡出.点击“返回顶部”页面以动画形式返回顶部.完美兼容ie6-11,firefox,chrome等. html ...
 - 干货:Android 源码使用心得分享
			
我相信很多初学者会和我一样经常在网上去找Android开发源码,但是往往因为运行不起来非常的懊恼!在做爱开发网站的时候,收集App代码时就遇到了这种困难,我相信网络上面的源码大部分在发布前 ...
 - Cocos2d-JS动画
			
与动作密不可分的还有动画,动画又可以分为场景过渡动画和帧动画.场景过渡动画我们在以往介绍过,这一个我们只介绍帧动画.帧动画帧动画就是按一定时间间隔.一定的顺序.一帧一帧地显示帧图片.我们的美工要为精灵 ...