dongnan
总版主
总版主
  • 粉丝52
  • 发帖数2165
  • 铜币13236枚
  • 威望5838点
  • 银元150个
  • 社区居民
  • 最爱沙发
  • 忠实会员
  • 原创写手
阅读:2067回复:3

mysql 5.6.x

楼主#
更多 发布于:2015-06-17 10:28
目标
整理mysql 5.6.x 相关知识

安装部署
参考这里:http://ywwd.net/read-858

不同之处
1. 使用cmake 编译安装
cmake . \
       -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc \
       -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci \
       -DENABLED_LOCAL_INFILE=1 -DWITH_READLINE=1
make
make install
相关编译参数可以参考这里:
http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html
http://howtolamp.com/lamp/mysql/5.6/installing/
http://www.cnblogs.com/xiongpq/p/3384681.html

2.  新的示例配置文档
#新的my.cnf 精简的有点不适应.

cat support-files/my-default.cnf
#...
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
  
[mysqld]
  
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
  
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
  
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....
  
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
  
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

3. 初始化需要指定数据目录  
#install_mysql_db
$mysql_dir/scripts/mysql_install_db  --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql

#待续....
dongnan
总版主
总版主
  • 粉丝52
  • 发帖数2165
  • 铜币13236枚
  • 威望5838点
  • 银元150个
  • 社区居民
  • 最爱沙发
  • 忠实会员
  • 原创写手
沙发#
发布于:2015-06-17 10:29
cmake 检查环境
示例:检查环境 & 默认参数 [code ]cmake . -LH[/code]-- Running cmake version 2.8.12.2
-- MySQL 5.6.25
-- Packaging as: mysql-5.6.25-Linux-x86_64
-- HAVE_VISIBILITY_HIDDEN
-- HAVE_VISIBILITY_HIDDEN
-- HAVE_VISIBILITY_HIDDEN
-- Using cmake version 2.8.12.2
-- Not building NDB
-- Library mysqlclient depends on OSLIBS -lpthread;m;rt;dl
-- Library mysqlserver depends on OSLIBS -lpthread;m;rt;crypt;dl
-- CMAKE_BUILD_TYPE: RelWithDebInfo
-- COMPILE_DEFINITIONS: HAVE_CONFIG_H
-- CMAKE_C_FLAGS:  -Wall -Wextra -Wformat-security -Wvla -Wwrite-strings -Wdeclaration-after-statement
-- CMAKE_CXX_FLAGS:  -Wall -Wextra -Wformat-security -Wvla -Woverloaded-virtual -Wno-unused-parameter
-- CMAKE_C_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- CMAKE_CXX_FLAGS_RELWITHDEBINFO: -O3 -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /root/tengine/mysql-5.6.25
-- Cache values
// Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
 CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel
CMAKE_BUILD_TYPE:STRING=RelWithDebInfo

// install prefix
CMAKE_INSTALL_PREFIX:PATH=/usr/local/mysql

// Set to true if this is a community build
COMMUNITY_BUILD:BOOL=ON

// Enable profiling
ENABLED_PROFILING:BOOL=ON
部分省略....
//
WITH_ZLIB:STRING=bundled

#
dongnan
总版主
总版主
  • 粉丝52
  • 发帖数2165
  • 铜币13236枚
  • 威望5838点
  • 银元150个
  • 社区居民
  • 最爱沙发
  • 忠实会员
  • 原创写手
板凳#
发布于:2015-06-18 12:11
mysql 5.6 慢查询日志设置
由 5.1
#log-slow-queries = /usr/local/mysql/data/slow.log
变更为
slow_query_log = 1

日志位置
#安装目录+主机名
ll /usr/local/mysql/data/localhost-slow.log
-rw-rw---- 1 mysql mysql 175 Jun 12 15:55 /usr/local/mysql/data/localhost-slow.log

#
dongnan
总版主
总版主
  • 粉丝52
  • 发帖数2165
  • 铜币13236枚
  • 威望5838点
  • 银元150个
  • 社区居民
  • 最爱沙发
  • 忠实会员
  • 原创写手
地板#
发布于:2018-05-21 19:20
mysql 5.6 配置文件
环境
1. mysql 5.6 源码方式安装。
2. 物理机,DELL R620 2cpu/32GB内存/400GB SSD*2/raid 1

配置文件
cat /etc/my.cnf

[mysqld]
user   = mysql
port   = 3306
socket = /tmp/mysql.sock
basedir  = /usr/local/mysql
datadir  = /usr/local/mysql/data
pid-file = /usr/local/mysql/data/mysql.pid
character_set_server = utf8
skip-name-resolve

# slow_log
long_query_time = 5
slow_query_log  = 1

# connect
max_connections = 2000
max_connect_errors = 1000
max_user_connections = 1000
interactive_timeout = 300
wait_timeout = 300

tmp_table_size = 32M
thread_cache_size = 100
key_buffer_size = 1024M

# innodb
default-storage-engine = INNODB
innodb_flush_log_at_trx_commit = 1
innodb_file_per_table = 1
innodb_buffer_pool_size = 10240M
innodb_log_file_size = 512M

# binlog
#log-bin=mysql-bin
#binlog_format = mixed
#server-id = 11
#sync_binlog = 1
#expire_logs_days = 15

#
游客

返回顶部