5.6.26源码安装包:http://pan.baidu.com/s/1kUl44WR
cmake安装包链接:http://pan.baidu.com/s/1c0LuwJA

操作系统版本:CentOS release 6.3 (Final)

安装过程:(记得挂载镜像,并且配置yum,方便yum安装各种依赖的包

CentOS配置yum:
1、cd  /etc/yum.repos.d
2、创建个任意目录,将所有文件移动到创建的目录中,除了CentOS-Media.repo
3、编辑CentOS-Media.repo
    vi  CentOS-Media.repo
[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

4、创建/media/CentOS/目录
5、挂载
    mount /dev/cdrom  /media/CentOS/

[root@hank-yoon ~]# mkdir -p /export/servers

[root@hank-yoon servers]# 上传安装脚本、MySQL源码安装包,Cmake安装包

[root@hank-yoon servers]#ls
cmake-2.8.3.tar.gz   mysql-5.6.26.tar.gz  install.sh

[root@hank-yoon servers]#sh install.sh

[root@hank-yoon servers]#cat  install.sh   脚本内容
#!/bin/bash

# check
echo -e "\033[;37;34mCheck Memory Size...\033[0m"
if [ `free -g|grep ^Mem|awk '{print $2}'` != 125 ]
then
read -p "Memory size is `free -g|grep ^Mem|awk '{print $2}'`G , enter innodb_buffer_pool_size(default 20G) : " pool
else
echo -e "\033[;37;32mMemory Size is 125G , innodb_buffer_pool_size set 100G\033[0m"
fi
echo -e "\033[;37;34mCheck Network...\033[0m"
#if ! ping -c 1 -w 1 www.baidu.com > /dev/null;then echo -e "\033[;37;31mPlease Check Network Before Setup\033[0m";exit 1;else echo -e "\033[;37;32mOK\033[0m";fi
echo -e "\033[;37;34mCheck Packet...\033[0m"
if ! ls mysql-5.6.26.tar.gz cmake-2.8.3.tar.gz > /dev/null;then echo -e "\033[;37;31mNo Packets\033[0m";exit 1;else echo -e "\033[;37;32mOK\033[0m";fi
# replace  yum.repos.d
#rm -f /etc/yum.repos.d/*
#wget -P /etc/yum.repos.d/ http://172.22.197.62/CentOS/app/script/CentOS-Media.repo
#sed -i 's/6.3/6.5/' /etc/yum.repos.d/CentOS-Media.repo
#echo -e "\033[;37;34mreplace  yum.repos.d...\033[0m"

#wget mysql cmake

#change IO scheduler
echo deadline > /sys/block/sda/queue/scheduler
echo -e "\033[;37;34mchange IO scheduler to deadline...\033[0m"

# init enviroment
echo -e "\033[;37;34mStarting Yum Install...\033[0m"
yum install -y ncurses-devel glibc gcc gcc-c++ libstdc++*  libtool cmake lrzsz libaio-devel 
echo -e "\033[;37;32mYum Install Done\033[0m"
echo -e "\033[;37;34mAdd MySQL OS User...\033[0m"
useradd mysql
echo -e "\033[;37;32mAdd User Done\033[0m"

setuplog=/home/mysql/logs/install-log
setupdir=$(pwd)
mysqldir=(/export/data/mysql/tmp /export/data/mysql/undo /export/data/mysql/data /export/servers/mysql/etc /export/data/mysql/dumps /export/data/mysql/log /home/mysql/scripts /home/mysql/logs)
mkdir -p ${mysqldir[*]}
chown mysql:mysql -R /export/data/mysql /home/mysql/

echo -e "\033[;37;34mExtracting package to /usr/local/src/\033[0m"
tar xzf cmake-2.8.3.tar.gz -C /usr/local/src
tar xzf mysql-5.6.26.tar.gz -C /usr/local/src
mv *.tar.gz /usr/local/src
echo -e "\033[;37;32mExtracting Done\033[0m"

# install
echo -e "\033[;37;34mInstall Cmake...\033[0m"
cd /usr/local/src/cmake-2.8.3 ; ./bootstrap && gmake && make install
if [ $? = 0 ];then echo -e "\033[;37;32mCmake Install Done\033[0m";else echo -e "\033[;37;31mCmake Install Faild\033[0m";fi

echo -e "\033[;37;34mInstall MySQL...\033[0m"
echo "Configure Error" > $setuplog
cd /usr/local/src/mysql-5.6.26 ; 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=3358 2>> $setuplog
make && make install
if [ $? = 0 ];then echo -e "\033[;37;32mMySQL Install Done\033[0m";else echo -e "\033[;37;31mMySQL Install Faild\033[0m";exit 1;fi
/sbin/ldconfig /export/servers/mysql/lib/

echo -e "\033[;37;34mModify /home/mysql/.bash_profile...\033[0m"
echo "export LANG=en_US.UTF-8" >> /home/mysql/.bash_profile
sed -i 's!PATH=$PATH:$HOME/bin!PATH=$PATH:$HOME/bin:/export/servers/mysql/bin!' /home/mysql/.bash_profile
source /home/mysql/.bash_profile
echo -e "\033[;37;32mDONE\033[0m"

# my.cnf
echo -e "\033[;37;34mCreate /export/servers/mysql/etc/my.cnf...\033[0m"
cat >> /export/servers/mysql/etc/my.cnf << EOF
[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         = 100G
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

EOF
serverid=$(ifconfig |grep Bcast|grep 'inet addr:' | awk '{print $2}' |awk -F. '{print $3$4}')
#serverid=$(ifconfig eth0|grep Bcast|grep 'inet addr:' | awk '{print $2}' |awk -F. '{print $3$4}')
sed -i 's/360360/'$serverid'/' /export/servers/mysql/etc/my.cnf
if [ ! -z $pool ];then sed -i 's/innodb_buffer_pool_size         = 100G/innodb_buffer_pool_size         = '$pool'/' /export/servers/mysql/etc/my.cnf;echo -e "\033[;37;34m`cat /export/servers/mysql/etc/my.cnf|grep innodb_buffer_pool_size`\033[0m";fi
echo -e "\033[;37;32mDONE\033[0m"

# start
/export/servers/mysql/scripts/mysql_install_db --user=mysql --basedir=/export/servers/mysql/ --datadir=/export/data/mysql/data/
/export/servers/mysql/bin/mysqld_safe --defaults-file=/export/servers/mysql/etc/my.cnf &
echo -e "\033[;37;34mStart MySQL\033[0m"
for i in {1..500};do [ -S /export/data/mysql/tmp/mysql.sock ] && echo -e "\033[;37;32m[OK]\033[0m" && break || echo -n ". ";sleep 2;done
if [ ! -S /export/data/mysql/tmp/mysql.sock ];then echo -e "\033[;37;31m[Start Faild,See /export/data/mysql/log/error.log]\033[0m";exit 1;fi

# cutting
echo -e "\033[;37;34mCreate Cutting.sh to Crontab\033[0m"
cat >> /home/mysql/scripts/cutting.sh << EOF
#!/bin/bash
mysql=/export/servers/mysql/bin/mysql
user=backup
password='7FH3iwIX90VdUInu'

generallog=/export/data/mysql/log/mysql.log
if [ -f \$generallog ]
then
        mv \$generallog \${generallog}.\`date  "+%Y%m%d%H"\`
        \$mysql -u\$user -p\$password -e "flush no_write_to_binlog general logs;"
fi

slowlog=/export/data/mysql/log/slow.log
if [ \`date "+%w"\` = 6 -a -f \$slowlog ]
then
        mv \$slowlog \${slowlog}.\`date  "+%Y%m%d%H"\`
        \$mysql -u\$user -p\$password -e "flush no_write_to_binlog slow logs;"
fi

find /export/data/mysql/log/ -type f -name "*.log.*" -mtime +7 |xargs rm -f
EOF
chown mysql.mysql /home/mysql/scripts/cutting.sh
chmod +x /home/mysql/scripts/cutting.sh
echo "1 0 * * * /home/mysql/scripts/cutting.sh" >> /var/spool/cron/mysql
echo "1 0 * * * /usr/sbin/ntpdate 172.17.1.134 | hwclock -w" >> /var/spool/cron/root
chown mysql.root /var/spool/cron/mysql
chmod 600 /var/spool/cron/mysql
/etc/init.d/crond restart
echo -e "\033[;37;32mDONE\033[0m"
mkdir /var/lib/mysql
ln -s /export/data/mysql/tmp/mysql.sock /var/lib/mysql/mysql.sock
chown -R mysql.mysql  /var/lib/mysql

echo -e "\033[;37;34mClean...\033[0m"
> /export/data/mysql/log/mysql.log
rm -f ${setupdir}/`basename $0`
echo -e "\033[;37;32mDONE\033[0m"

# add service 
cp /export/servers/mysql/support-files/mysql.server /etc/init.d/mysql

# rpl semi sync ON
/export/servers/mysql/bin/mysql -uroot -e "install plugin rpl_semi_sync_master soname 'semisync_master.so'"
/export/servers/mysql/bin/mysql -uroot -e "install plugin rpl_semi_sync_slave soname 'semisync_slave.so'";
sed -i 's/#rpl_semi_sync_master_enabled/rpl_semi_sync_master_enabled/' /export/servers/mysql/etc/my.cnf
sed -i 's/#rpl_semi_sync_slave_enabled/rpl_semi_sync_slave_enabled/' /export/servers/mysql/etc/my.cnf
sed -i 's/#rpl_semi_sync_master_timeout/rpl_semi_sync_master_timeout/' /export/servers/mysql/etc/my.cnf

# mysql restart
service mysql restart

MySQL 5.6.26源码安装的更多相关文章

  1. MySQL学习之路 一 : MySQL 5.7.19 源码安装

    MySQL 5.7.19 源码安装 查看系统: # cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core) 安装依赖包 # yum - ...

  2. CentOS 6.5 MySQL5.6.26源码安装

    一.源码安装cmake工具 从mysql5.5起,mysql源码安装开始使用cmake wget http://cmake.org/files/v3.2/cmake-3.2.3.tar.gztar z ...

  3. mysql 在cento下源码安装

    虚拟机改为网络地址转换 (NAT) service network restartping www.baidu.com rpm -qa | grep mysql 有的话通过下面的命令来卸载掉 rpm ...

  4. 数据库的硬迁移和mysql 5.5.38源码安装

    场景:一台服务器出现了故障,需要把数据库迁移到另一台服务器上,由于数据效大,直接压缩数库的数据目录(在数据库DOWN的情况下)数据库版本mysql 5.5.38安装方式:源码安装思路:在另一台服务器上 ...

  5. LNMP架构下的nginx、mysql、php的源码安装

    一.LNMP的介绍 LNMP就是Linux+Nginx+Mysql+Php这种网站服务架构.Linux是一类Unix计算机操作系统的统称,是目前最流行的免费操作系统,常见版本有:centos.ubun ...

  6. mysql 5.7.18 源码安装笔记

    之所以贴出这样一篇笔记呢?主要是因为很久之前,源码安装MySQL的时候,碰到了太多太多的坎坷. 如果你有兴趣进行源码安装,那么请不要以这篇文章为标准,因为每个人的及其环境等其他因素还是差距比较大的. ...

  7. linux应用之Lamp(apache+mysql+php)的源码安装(centos)

    Linux+Apache+Mysql+Php源码安装 一.安装环境: 系统:Centos6.5x64 Apache: httpd-2.4.10.tar.gz Mysql: mysql-5.6.20-l ...

  8. mysql 5.7.11 源码安装

    mysql5.711安装 1.安装boost包下载地址http://sourceforge.net/projects/boost/files/boost/ 2.解压boost_1_59_0.tar.g ...

  9. mysql++ 3.2.3 源码安装

    https://tangentsoft.com/mysqlpp/home 下载 wget https://tangentsoft.com/mysqlpp/releases/mysql++-3.2.3. ...

随机推荐

  1. Oracle数据库SQL优化

    SQL优化的最终目的是用户体验-在最短时间内让用户在页面数据.因此,执行时间是SQL优化的重要指标.在SQL查询中,I/O操作最占系统性能的.I/O操作量越大,时间越久.减少I/O操作量是优化SQL的 ...

  2. 基本API-StdIn.java

    /************************************************************************* * Compilation: javac StdI ...

  3. javascript函数的声明和调用

    × 目录 [1]函数的声明方式 [2]函数的调用方式 [3]两种声明方式的区别 函数:将完成某一特定功能的代码集合起来,可以重复使用的代码块. ---------------------------- ...

  4. MVC3 Razor视图引擎的基础语法

    好久没有关注微软的开发了,今天看到了MVC3,顺便学习学习,我觉得Razor是个不错的做法,比使用<%%>简单多了,而且好看.首先“_”开头的cshtml文档将不能在服务器上访问,和asp ...

  5. 每天一道LeetCode--58. Length of Last Word

    Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the l ...

  6. Java之简单图形面积计算

    设计一个类层次,定义一个抽象类--形状(类名:shape).其中包括求形状的面积抽象方法(方法名:calArea()).继承该抽象类定义三角形(Triangle).矩形(Rectangle).圆(Ci ...

  7. OpenFiler安装与基本配置

    一.            安装篇 1.      插入安装盘 2.      选择键盘输出 3.      对硬盘进行分区 4.      删除所有数据并重新分区 5.      配置IP地址等信息 ...

  8. ocx在我indows7无法注册

    公司今天用到一个  要用到ocx ,我调试好久都无法安装..... 后来在网上看到.原来是没有安装 VC Redist Installer(VC20052008201020122013)运行库合集 导 ...

  9. Swift数据类型及数据类型转换

    整型  Swift 提供 8.16.32.64 位形式的有符号及无符号整数.这些整数类型遵循 C 语言的命名规 约,如 8 位无符号整数的类型为 UInt8,32 位 有符号整数的类型为 Int32 ...

  10. UIAlertView[警告框] [代理协议型]UIActionSheet [表单视图][代理协议型]

    ////  ViewController.h//  UIAlertViewAndUIActionSheet////  Created by hehe on 15/9/21.//  Copyright ...