[mysqld]
#skip-grant-tables
port = 3306
#MYSQL的安装路径
basedir = /data/prog/mysql/
#数据库保存目录
datadir = /data/apd/mysql/data
#socket的目录
socket = /data/apd/mysql/mysql.sock
#pid的目录
pid-file = /data/apd/mysql/mysql.pid
#设置默认编码
character-set-server = utf8mb4
collation_server = utf8mb4_unicode_ci
#主从时服务ID,保证每个实例的ID要唯一
server-id = 3306
#MySQL数据库及表(仅MyISAM)支持符号链接(symbolic link),数据库或表可以存储在my.cnf中指定datadir之外的分区或目录。
symbolic-links = 0
##### 日志配置 #####
log-error = /data/logs/mysql/error_log.log
general_log_file = /data/logs/mysql/query_log.log
slow_query_log_file = /data/logs/mysql/slow_log.log
general_log = 0
slow-query-log = 0
long_query_time = 3
##### binlog配置 #####
log-bin = /data/logs/mysql/log-bin/log_bin
log-bin-index = /data/logs/mysql/log-bin/log_bin.index
log_slave_updates
binlog_format = row
expire_logs_days = 7
sync_binlog = 1
log-bin-trust-function-creators = 1
event_scheduler = on
master_info_repository = TABLE
relay_log_info_repository = TABLE
relay_log_recovery = 1
binlog_gtid_simple_recovery = 1
#####全局配置#####
sql_mode = 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
skip-name-resolve
skip-external-locking
# skip-innodb
default-storage-engine = InnoDB
#忽略大小写
lower_case_table_names = 1
max_connections = 3000
open_files_limit = 65535
max_allowed_packet = 200M
thread_cache_size = 16
tmp_table_size = 512M
max_heap_table_size = 512M
table_open_cache = 1024
read_buffer_size = 2M
sort_buffer_size = 8M
join_buffer_size = 8M
read_rnd_buffer_size = 16M
##### MyISAM 相关配置 #####
# MyISAM buffer
key_buffer_size = 512M
bulk_insert_buffer_size = 16M
myisam_sort_buffer_size = 64M
##### InnoDB optimization #####
innodb_large_prefix = on
innodb_file_format = Barracuda
innodb_file_format_max = Barracuda
innodb_purge_threads = 4
innodb_print_all_deadlocks = 1
innodb_strict_mode = 1
innodb_lock_wait_timeout = 5
# InnoDB buffer
innodb_data_home_dir = /data/apd/mysql/data
innodb_data_file_path = ibdata1:1000M;ibdata2:10M:autoextend
innodb_buffer_pool_size = 4G
innodb_buffer_pool_instances = 8
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
# redo log
innodb_log_group_home_dir = /data/apd/mysql/data
innodb_log_file_size = 1G
innodb_log_files_in_group = 2
innodb_log_buffer_size = 16M
# undo log
innodb_undo_directory = /data/apd/mysql/data
innodb_undo_tablespaces = 3
innodb_undo_logs = 128
innodb_flush_log_at_trx_commit = 2
innodb_lock_wait_timeout = 50
innodb_thread_concurrency = 64
# SSD硬盘优化
innodb_page_size = 16k
innodb_flush_neighbors = 0
innodb_io_capacity = 4000
innodb_io_capacity_max = 8000
[client]
socket = /data/apd/mysql/mysql.sock #用于本地连接的socket套接字
port=3306
#默认连接端口
default-character-set = utf8mb4
#默认编码
[mysql]
#这个也是客户端设置
no-beep
#发生错误时不要发出蜂鸣声
default-character-set = utf8mb4
#默认编码
socket = /data/apd/mysql/mysql.sock
#用于本地连接的socket套接字