l  软件目录

[root@MASTER_03 ~]# mkdir -pv /data/software

[root@MASTER_03 ~]# cd /data/software/

[root@MASTER_03 mysql-5.6.28-linux-glibc2.5-x86_64]# tar xvf mysql-5.6.28-linux-glibc2.5-x86_64.tar.gz

l  软件下载

[root@MASTER_03 software]# wget http://120.198.244.50:9999/cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.28-linux-glibc2.5-x86_64.tar.gz

 

l  安装过程

[root@MASTER_03 ~]# groupadd mysql

[root@MASTER_03 ~]# useradd -g mysql -d /usr/local/mysql -s /sbin/nologin mysql

[root@MASTER_03 data]# mkdir -pv /opt/app/mysql

[root@MASTER_03 ~]# chown -R mysql.mysql /usr/local/mysql/

[root@MASTER_03 data]# chown -R mysql.mysql /opt/app/mysql/

[root@MASTER_03 data]# mkdir -pv /data/3306/{tmp,logs,data}

[root@MASTER_03 ~]# chown -R mysql.mysql /data/mysql

[root@MASTER_03 ~]# cd /data/software/

[root@MASTER_03 ~]# mv mysql-5.6.28-linux-glibc2.5-x86_64/* /opt/app/mysql/

[root@MASTER_03 ~]# cd /opt/app/mysql/

[root@MASTER_03 mysql]# ./scripts/mysql_install_db --basedir=/opt/app/mysql --datadir=/data/3306/data --user=mysql

[root@MASTER_03 mysql]# cp support-files/mysql.server /etc/init.d/mysqld

[root@MASTER_03 mysql]# chmod +x /etc/init.d/mysqld

 

 

=============================my.cnf的配置=========================================================

[client]

port = 3306

socket      = /data/3306/tmp/mysql.sock

# The MySQL server

[mysqld]

###base

explicit_defaults_for_timestamp=true

port = 3306

user            = mysql

basedir     = /opt/app/mysql

datadir     = /data/3306/data

pid-file      = /data/3306/tmp/mysql.pid

socket      = /data/3306/tmp/mysql.sock

character_set_server = utf8

tmpdir = /dev/shm

server-id = 033306

skip_name_resolve = 1

skip_external_locking = 1

lower_case_table_names = 1

# logs

long_query_time     = 1

slow_query_log = 1

slow_query_log_file = /data/3306/logs/slow.log

log_error = /data/3306/logs/error.log

 

# binlog

binlog_format = row

log_bin     = /data/3306/logs/mysql-bin

binlog_cache_size = 8M

max_binlog_size = 1G

max_binlog_cache_size = 4G

expire_logs_days = 5

log_bin_trust_function_creators = 1

############ myisam

key_buffer_size = 64M

#bulk_insert_buffer_size = 32M

########## PGA

sort_buffer_size = 8M

read_buffer_size = 8M

join_buffer_size = 32M

read_rnd_buffer_size = 32M

query_cache_type = 0

query_cache_size = 0M

table_open_cache = 6144

table_definition_cache = 4096

open_files_limit = 65536

back_log = 512

max_connections = 1100

max_user_connections = 1000

max_connect_errors = 10000

max_allowed_packet = 128M

thread_cache_size = 64

thread_stack=192k

tmp_table_size=128M

max_heap_table_size=128M

# InnoDB

transaction_isolation = READ-COMMITTED

innodb_data_home_dir = /data/3306/data

innodb_log_group_home_dir = /data/3306/data

innodb_data_file_path = ibdata1:1G:autoextend

innodb_buffer_pool_size = 1G

innodb_buffer_pool_instances    = 8

#innodb_additional_mem_pool_size = 16M

innodb_log_file_size = 1024M

innodb_log_buffer_size = 64M

innodb_log_files_in_group = 3

innodb_flush_log_at_trx_commit = 1

innodb_lock_wait_timeout = 10

innodb_sync_spin_loops = 40

innodb_max_dirty_pages_pct = 80

innodb_thread_concurrency = 0

innodb_thread_sleep_delay = 500

innodb_concurrency_tickets = 1000

innodb_flush_method = O_DIRECT

innodb_file_per_table = 1

innodb_read_io_threads = 20

innodb_write_io_threads = 20

innodb_io_capacity = 600

innodb_file_format = Barracuda

innodb_purge_threads=1

innodb_purge_batch_size = 32

innodb_old_blocks_pct=50

innodb_stats_on_metadata=0

 

 

#

optimizer_switch='mrr=on,mrr_cost_based=off,batched_key_access=on'

# wait

#wait_timeout = 28800

#interactive_timeout = 120

#connect_timeout = 20

#slave-net-timeout = 30

[mysqldump]

quick

max_allowed_packet = 128M

#myisam_max_sort_file_size = 10G

[mysql]

no-auto-rehash

max_allowed_packet = 128M

 

default_character_set          = utf8

[myisamchk]

key_buffer_size = 64M

sort_buffer_size = 512k

read_buffer = 2M

write_buffer = 2M

[mysqlhotcopy]

interactive-timeout

 

 

==================================/etc/init.d/mysqld中需要修改的2个地方=====================================

basedir=/opt/app/mysql

datadir=/data/3306/data

 

posted on 2016-01-03 12:59  懒睡的猫熊  阅读(279)  评论(0编辑  收藏  举报