mysql配置文件集锦

1,4核8G内存 主读

[client]
port    = 3306
socket    = /tmp/mysql.sock
default-character-set = utf8 #设置客户端的字符编码

[mysqld]
#basic settings#
default-time_zone=‘+8:00‘
character-set-server=utf8
collation-server=utf8_general_ci
basedir = /usr/local/mysql
datadir=/usr/local/mysql/data/data
socket=/tmp/mysql.sock
#pid-file=/var/run/mysqld/mysqld.pid
port = 3306
server-id = 2
symbolic-links=0
max_allowed_packet = 100MB
slave_pending_jobs_size_max = 200MB
transaction-isolation = READ-COMMITTED

#主从配置
#master-host=192.168.108.167
#master-user=flowtrade
#master-password=123456
#master-port=3306
#master-connect-retry=60
#replicate-do-db =flow_trade
#replicate-ignore-db=mysql

#connection#
interactive_timeout = 28800
wait_timeout = 28800
lock_wait_timeout = 1200
skip_name_resolve = 1
max_connections = 2000
max_connect_errors = 1000000

#log setting#
log-bin=mysql-bin-log
#log-error=/usr/local/mysql/data/mysql-error.log
long_query_time = 5
slow_query_log = 1
slow_query_log_file = /usr/local/mysql/data/slow.log
expire_logs_days = 90
log_slave_updates = 1
relay_log = mysql-relay-bin
relay_log_recovery=1
log_timestamps = SYSTEM
master_info_repository=TABLE
relay_log_info_repository=TABLE

#innodb settings#
innodb_flush_log_at_trx_commit = 1
sync_binlog = 1
innodb_file_per_table = 1
innodb_buffer_pool_size = 4G
innodb_doublewrite = ON
innodb_thread_concurrency = 64
innodb_purge_threads = 6
innodb_read_io_threads = 8
innodb_write_io_threads = 8
innodb_buffer_pool_instances = 8
innodb_log_file_size = 1GB
innodb_log_files_in_group = 3
innodb_log_buffer_size = 50M
innodb_io_capacity = 200
innodb_io_capacity_max = 400
innodb_flush_method=O_DIRECT
innodb_flush_neighbors = 0
innodb_print_all_deadlocks = 1

#session memory setting#
join_buffer_size = 6M
query_cache_type = 1
thread_cache_size = 64
query_cache_size = 128M
table_open_cache = 2000
sort_buffer_size = 6M
read_buffer_size = 6M
read_rnd_buffer_size = 6M

#replication setting#
slave-parallel-type = LOGICAL_CLOCK
slave-parallel-workers = 4
slave_skip_errors = ddl_exist_errors

2,4核16G 主写

[client]
port    = 3306
socket    = /tmp/mysql.sock
default-character-set = utf8 #设置客户端的字符编码

[mysqld]

#basic settings#
default-time_zone = ‘+8:00‘
character-set-server = utf8
collation-server = utf8_general_ci
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data/data
socket = /tmp/mysql.sock
#pid-file = /var/run/mysqld/mysqld.pid
bind_address = 0.0.0.0
port = 3306
server-id = 1
max_allowed_packet = 100MB
transaction-isolation = READ-COMMITTED

#主从复制数据库设置
binlog-do-db=flow_trade
binlog-ignore-db=mysql

#connection#
interactive_timeout = 28800
wait_timeout = 28800
lock_wait_timeout = 1200
skip_name_resolve = 1
max_connections = 3000  ##最大连接数,需根据业务实际用户链接设置
max_connect_errors = 1000000

#log setting#
#log-error = /usr/local/mysql/data/datamysql-error.log
long_query_time = 5
slow_query_log = 1
slow_query_log_file = /usr/local/mysql/data/data/slow.log
expire_logs_days = 90
log_slave_updates = 1
log-bin=/usr/local/mysql/data/data/mysql-bin-log
log_timestamps = SYSTEM

#innodb settings#
innodb_flush_log_at_trx_commit = 1
sync_binlog = 1
innodb_file_per_table = 1
innodb_buffer_pool_size = 10G
innodb_doublewrite = ON
innodb_thread_concurrency = 64
innodb_purge_threads = 6
innodb_read_io_threads = 6
innodb_write_io_threads = 6
innodb_buffer_pool_instances = 6
innodb_log_file_size = 1GB
innodb_log_files_in_group = 3
innodb_log_buffer_size = 50M
innodb_io_capacity = 200        ##根据磁盘的实际IO能力设置
innodb_io_capacity_max = 400
innodb_flush_method=O_DIRECT
innodb_flush_neighbors = 0
innodb_print_all_deadlocks = 1

#session memory setting#
join_buffer_size = 6M
thread_cache_size = 256
query_cache_type = 1
query_cache_size = 128M
table_open_cache = 2000
sort_buffer_size = 6M
read_buffer_size = 6M
read_rnd_buffer_size = 6M
时间: 2024-10-26 15:03:47

mysql配置文件集锦的相关文章

MySQL配置文件mysql.ini参数详解、MySQL性能优化

MySQL配置文件mysql.ini参数详解.MySQL性能优化 my.ini(Linux系统下是my.cnf),当mysql服务器启动时它会读取这个文件,设置相关的运行环境参数. my.ini分为两块:Client Section和Server Section.   Client Section用来配置MySQL客户端参数.   要查看配置参数可以用下面的命令: show variables like '%innodb%'; # 查看innodb相关配置参数 show status like

mysql配置文件my.cnf整理

随时修改: 1 [mysqld] 2 #basedir= 3 datadir=/var/lib/mysql 4 #mysql.default_port=3306 5 #mysql.default_socket=/tmp/mysql.sock 6 socket=/var/lib/mysql/mysql.sock 7 #socket=/tmp/mysql.sock 8 user=mysql 9 # Disabling symbolic-links is recommended to prevent

EF MySql 配置文件

1 <?xml version="1.0" encoding="utf-8"?><!--有关如何配置 ASP.NET 应用程序的详细信息,请访问 2 http://go.microsoft.com/fwlink/?LinkId=169433 3 --> 4 <configuration> 5 <configSections> 6 <!-- For more information on Entity Framew

MySQL 配置文件my.cnf

转载: MySQL配置文件my.cnf 详解: #BEGIN CONFIG INFO#DESCR: 4GB RAM, 只使用InnoDB, ACID, 少量的连接, 队列负载大#TYPE: SYSTEM#END CONFIG INFO ## 此mysql配置文件例子针对4G内存. # 主要使用INNODB#处理复杂队列并且连接数量较少的mysql服务器## 将此文件复制到/etc/my.cnf 作为全局设置,# mysql-data-dir/my.cnf 作为服务器指定设置# (@[email 

linux中查看nginx、apache、php、mysql配置文件路径的方法

转自:http://www.phper163.com/archives/368 如何在linux中查看nginx.apache.php.mysql配置文件路径了,如果你接收一个别人配置过的环境,但没留下相关文档.这时该怎么判断找到正确的加载文件路径了.可以通过以下来判断1.判断apache首先执行命令找到httpd路径ps aux | grep httpd如httpd路径为 /usr/local/apache/bin/httpd然后执行以下命令/usr/local/apache/bin/http

mysql常见问题集锦

首先你应该试着找出问题mysqld守护进程是否死掉或你的问题是否与你的客户有关.你可以用mysqladmin version检查你的mysqld服务器正常执行了多长时间,如果mysqld死了,你可以在文件“mysql-data- directory/’hostname’.err”中找到其原因. 使用MySQL时的一些常见错误 MySQL server has gone away 常见的原因是服务器超时了并且关闭了连接.缺省地,如果没有事情发生,服务器在 8个小时后关闭连接.你可在启动mysqld

Mysql配置文件my.ini详解

原链接:http://blog.sina.com.cn/s/blog_718ac8bf0100pkvp.html 以下是Mysql数据库服务器配置文件my.ini的详细配置.应用场合是InnoDB引擎,2核CPU, 32位SUSE. [client] #password = your_password port  = 3306 socket  = /tmp/mysql.sock # Here follows entries for some specific programs # The MyS

Mysql配置文件my.cnf配置及配置参数详解

Mysql配置文件my.cnf 安装了mysql没有my.cnf文件的情况 1.可以把mysql的示例配置文件,如my-medium.cnf拷贝到/etc/my.cnf,再去修改/etc/my.cnf的配置/usr/share/doc/MySQL-server-5.5.38/my-medium.cnf(Example MySQL config file for medium systems with little memory (32M - 64M) ) 可以通过命令:find / -name 

mysql配置文件解读

基 本是通过内存大小来选择mysql的配置文件的,那有博友会说了,现在的服务器动不动就是32G内存或者64G内存,甚至更大的内存,你那个配置文件最大 只支持4G内存是不是有点小了,确认会有这样的问题,从mysql5.6以后,为了更大的发挥mysql的性能,已经去除了配置文件选择,只有一个默认的 配置文件,里面只有一些基本配置,所有设置管理员都可以根据自己实际的需求进行自行设置,好了说了这么多,我们就来说一说,在企业的用的最多的my- innodb-heavy-4G.cnf配置文件! 二.详解 m