博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mysql 5.7配置小记
阅读量:6443 次
发布时间:2019-06-23

本文共 2177 字,大约阅读时间需要 7 分钟。

hot3.png

常配置MySQL服务的一些设置记录

[client]

port = 3306
default-character-set = utf8

[mysqld]

port = 3306
user = mysql
character-set-server = utf8
skip-external-locking
skip_name_resolve = ON
bind_address=

max_connections = 5000

max_connect_errors = 10
max_allowed_packet = 64M

default-storage-engine = INNODB

innodb_file_per_table = 1
innodb_buffer_pool_size = 16G
innodb_log_file_size = 256M
innodb_log_buffer_size = 8M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_flush_log_at_trx_commit = 2
innodb_lock_wait_timeout = 60
innodb_flush_method = O_DIRECT

default-time-zone = '+8:00'

event_scheduler = ON
open_files_limit = 51200
read_buffer_size = 2M
read_rnd_buffer_size = 8M
sort_buffer_size = 8M
join_buffer_size = 8M
key_buffer_size = 16M

thread_cache_size = 64

query_cache_type = 1
query_cache_size = 256M
query_cache_limit = 10M

transaction_isolation = READ-COMMITTED

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

server-id = 1

log_bin = mysql-bin
binlog_format = mixed
binlog_ignore_db = mysql
expire_logs_days = 90

log_error =/var/log/mysql-error.log

innodb_print_all_deadlocks = 1
slow_query_log = 1
long_query_time = 5
log_queries_not_using_indexes = 1
slow_query_log_file =/var/log/mysql-slow.log

[mysqldump]

quick
max_allowed_packet = 500M

 

systemctl enable mysqld

systemctl start mysqld
systemctl status mysqld
grep "temporary password" /var/log/mysqld.log
mysql -u root -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Uiop!789';

grant replication slave on *.* to 'repuser'@'slaveip' identified by 'Ei:saH0u9ys<';

flush privileges;
show master status;

slave的配置

server-id=18
log-bin = mysql-bin
sync_binlog=1
binlog_format=row
binlog_ignore_db=mysql
expire_logs_days = 30

change master to master_host='masterip',master_port=3306,master_user='repuser',master_password='Ei:saH0u9ys<',master_log_file='bin-log.000005',master_log_pos=120;

start slave;
show slave status\G

主库设置binlog_group_commit_sync_delay=1

在MySQL5.7中,开启enhanced multi-threaded slave,从库具体配置参数如下:

slave-parallel-type=LOGICAL_CLOCK
slave-parallel-workers=8
master_info_repository=TABLE
relay_log_info_repository=TABLE
relay_log_recovery=ON

 

 

 

转载于:https://my.oschina.net/u/2404183/blog/1546969

你可能感兴趣的文章
小tip:纯CSS让overflow:auto页面滚动条出现时不跳动
查看>>
Linq Like
查看>>
Linux知识积累(4) Linux下chkconfig命令详解
查看>>
centos关机与重启命令
查看>>
[Eth]Mac/Phy/mdio/Rgmii
查看>>
C++中的函数指针和函数对象总结
查看>>
ELK学习总结(3-2)elk的过滤查询
查看>>
快速定位oracle故障-恩墨
查看>>
Redis可视化工具 Redis Desktop Manager
查看>>
Go基础系列:为select设置超时时间
查看>>
Android网络请求之OkHttp框架
查看>>
《Apache Kafka实战》读书笔记-调优Kafka集群
查看>>
小程序开发事项
查看>>
福利 | 2018各大技术大会资料汇总(可下载)
查看>>
寻找下一代CTO - 激发潜能把握成功!!
查看>>
用DELPHI 开发压缩、解压、自解压、加密
查看>>
Linux命令行得到系统IP
查看>>
SQL Server索引的维护 - 索引碎片、填充因子 <第三篇>
查看>>
python类型转换、数值操作(收藏)
查看>>
mysql delimiter
查看>>