it运维开发教程,运维管理,因为微不足道,所以值得关注!域名来源:sos 救援 idc 数据中心 所以sos+idc=sosidc.com
  • 首页
  • mysql
  • 最新 linux (centos6.7)下mysql 5.7源码编译安装配置教程

最新 linux (centos6.7)下mysql 5.7源码编译安装配置教程

发布:admin2016-1-27 13:40分类: mysql

最新 linux (centos6.7)下mysql 5.7安装配置教程

一.安装环境

    系统:CentOS release 6.7 (Final)

    MySQL版本: mysql-5.7.10   官方下载地址:http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.10.tar.gz

    gcc版本:gcc (GCC) 4.4.7

    boost版本:默认情况下这个不需要,但是因为MySQL版本太新,系统自带boost版本较低,所以就下载了一个boost源码,编译时候指定路径就可以了

   下载地址:wget http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz/download

二.系统环境配置

yum -y install gcc-c++ ncurses-devel cmake make perl gcc autoconf automake zlib libxml libgcrypt libtool bison 这些包都是源码编译时候依赖的包;

     直接执行就可以了!

三.安装开始

说明:MySQL编译安装一般不在root下直接安装,这样是为了安全,可以新建一个系统普通账户进行安装

   下载安装

 wget http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz/download
 tar -zxvf boost_1_59_0.tar.gz

 wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.10.tar.gz
 tar -zxvf   mysql-5.7.10.tar.gz

 cd mysql-5.7.10  cmake  -DCMAKE_INSTALL_PREFIX=/home/ayl/mysql5.7     //安装路径
        -DDEFAULT_CHARSET=utf8                        //下边三行指定编码
        -DDEFAULT_CHARSET=utf8 -DEXTRA_CHARSETS=all
        -DDEFAULT_COLLATION=utf8_general_ci
        -DDOWNLOAD_BOOST=1                            //指定新版本boost源码路径,如果系统自带的版本比较新,这项不是必须的
        -DWITH_BOOST=/home/ayl/source/boost_1_59_0/
 make
 make install
 安装完成      
四..安装开始

   这个与以前的版本不同,初始化不在使用mysql_install_db脚本  换成了

 

./bin/mysqld  --defaults-file=./etc/my.cnf   --initialize

配置文件my.cnf 内容为,可以根据自己需求定义下边路径


[client]
port                    = 3306
socket          = /tmp/mysql.sock
default-character-set   = utf8

[mysql]
no-auto-rehash
default-character-set   = utf8
[mysqld]
port            = 3306
basedir         = /home/ayl/mysql
datadir         = /home/ayl/mysql5.7/data/
#socket          = /home/ayl/mysql5.7/run/mysql.socket
socket          = /tmp/mysql.sock
pid-file         = /home/ayl/mysql5.7/run/mysql.pid
user            = mysql
server-id       = 13506
init-connect='SET NAMES utf8'
character-set-server = utf8

max_connections = 200 
max_delayed_threads = 60
back_log = 500 
max_connect_errors = 10
table_open_cache = 128 
max_allowed_packet = 32M 
binlog_cache_size = 1M
max_heap_table_size = 64M 
read_buffer_size = 2M
read_rnd_buffer_size = 16M 
sort_buffer_size = 8M
join_buffer_size = 8M
thread_cache_size = 8
ft_min_word_len = 4
default-storage-engine = innodb
thread_stack = 192K
transaction_isolation = REPEATABLE-READ
tmp_table_size = 64M
explicit_defaults_for_timestamp=true

tmpdir              = /home/ayl/mysql5.7/tmp
slave-load-tmpdir   = /home/ayl/mysql5.7/tmp

skip-external-locking
skip-name-resolve
skip-symbolic-links
query_cache_type = 2
expire_logs_days = 30

log-error           = /home/ayl/mysql5.7/log/mysql.err
log-bin             = /home/ayl/mysql5.7/log/mysql.bin
binlog_format       = row
slow_query_log      = true
slow_query_log_file = /home/ayl/mysql5.7/log/mysql.slow
long_query_time     = 1
log-slave-updates
replicate_wild_ignore_table=mysql.%
replicate_wild_ignore_table=performance_schema.%
replicate_wild_ignore_table=information_schema.%
replicate_wild_ignore_table=test.%
replicate_wild_ignore_table=sys.%

key_buffer_size = 128M
bulk_insert_buffer_size     = 64M

innodb_data_file_path = ibdata1:512M;ibdata2:16M:autoextend
innodb_buffer_pool_size = 512M
innodb_write_io_threads = 8
innodb_read_io_threads = 8
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 1
innodb_log_file_size = 100M
innodb_log_buffer_size = 8M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120


#gtid
gtid_mode=ON
log_slave_updates
enforce_gtid_consistency

# 默认不启动从库
skip_slave_start
sql-mode=NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

[mysqldump]
quick
max_allowed_packet = 16M
[myisamchk]
key_buffer_size = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
open-files-limit = 5000



 


温馨提示如有转载或引用以上内容之必要,敬请将本文链接作为出处标注,谢谢合作!

已有 0/18289 人参与

发表评论:

欢迎使用手机扫描访问本站,还可以关注微信哦~