<code>主</code>
<code>cat</code> <code>my.cnf</code>
<code>[client]</code>
<code>port = 3306</code>
<code>socket = </code><code>/opt/3306/mysql</code><code>.sock</code>
<code>character-</code><code>set</code><code>-server = utf8</code>
<code> </code>
<code>[mysql]</code>
<code>no-auto-rehash</code>
<code>[mysqld]</code>
<code>user = mysql</code>
<code>port = 3306</code>
<code>socket = </code><code>/opt/3306/mysql</code><code>.sock</code>
<code>basedir = </code><code>/opt/mysql</code>
<code>datadir = </code><code>/opt/3306/data</code>
<code>explicit_defaults_for_timestamp = </code><code>true</code>
<code>skip-ssl</code>
<code>secure-</code><code>file</code><code>-priv = NULL</code>
<code>lower_case_table_names = 1</code>
<code>back_log = 300</code>
<code>max_connections = 3000</code>
<code>max_connect_errors = 100</code>
<code>table_open_cache = 4096</code>
<code>external-locking = FALSE</code>
<code>max_allowed_packet = 32M</code>
<code>sort_buffer_size = 16M</code>
<code>join_buffer_size = 16M</code>
<code>thread_cache_size = 16</code>
<code>query_cache_size = 128M</code>
<code>query_cache_limit = 4M</code>
<code>ft_min_word_len = 8</code>
<code>thread_stack = 512K</code>
<code>transaction_isolation = REPEATABLE-READ</code>
<code>tmp_table_size = 512M</code>
<code>max_heap_table_size = 512M</code>
<code>###*** slow query parameters</code>
<code>long_query_time = 6</code>
<code>slow_query_log</code>
<code>slow_query_log_file = </code><code>/opt/3306/slow</code><code>.log</code>
<code>###*** binlog parameters</code>
<code>log-bin = </code><code>/opt/3306/mysql-bin</code>
<code>binlog_cache_size = 4M</code>
<code>max_binlog_cache_size = 256M</code>
<code>max_binlog_size = 32M</code>
<code>#binlog_format = MIXED</code>
<code>binlog_format = row</code>
<code>expire_logs_days = 7</code>
<code>###*** relay-log parameters</code>
<code>#relay-log = /opt/3307/relay-bin</code>
<code>#relay-log-info-file = /opt/3307/relay-log.info</code>
<code>#master-info-repository = table</code>
<code>#relay-log-info-repository = table</code>
<code>#relay-log-recovery = 1</code>
<code>#*** MyISAM parameters</code>
<code>key_buffer_size = 16M</code>
<code>read_buffer_size = 1M</code>
<code>read_rnd_buffer_size = 16M</code>
<code>bulk_insert_buffer_size = 1M</code>
<code>#skip-name-resolve</code>
<code>###*** master-slave replication parameters</code>
<code>server-</code><code>id</code> <code>= 1</code>
<code>slave-skip-errors = all</code>
<code>#*** Innodb storage engine parameters</code>
<code>innodb_buffer_pool_size = 6G</code>
<code>innodb_data_file_path = ibdata1:10M:autoextend</code>
<code>#innodb_file_io_threads = 8</code>
<code>innodb_thread_concurrency = 16</code>
<code>innodb_flush_log_at_trx_commit = 2</code>
<code>innodb_log_buffer_size = 16M</code>
<code>innodb_log_file_size = 512M</code>
<code>innodb_log_files_in_group = 3</code>
<code>innodb_max_dirty_pages_pct = 90</code>
<code>innodb_lock_wait_timeout = 120</code>
<code>innodb_file_per_table = on</code>
<code>sql_mode=</code><code>'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'</code>
<code>gtid-mode=on</code>
<code>enforce-gtid-consistency=</code><code>true</code>
<code>master-info-repository=TABLE</code>
<code>relay-log-info-repository=TABLE</code>
<code>sync</code><code>-master-info=1</code>
<code>slave-parallel-workers=2</code>
<code>binlog-checksum=CRC32</code>
<code>master-verify-checksum=1</code>
<code>slave-sql-verify-checksum=1</code>
<code>binlog-rows-query-log_events=1</code>
<code>report-port=3306</code>
<code>report-host=主ip</code>
<code>connect-timeout = 60</code>
<code>wait-timeout = 28800</code>
<code>net_buffer_length = 16384</code>
<code>#thread_stack = 192K</code>
<code>#thread_concurrency = 128</code>
<code>query_cache_min_res_unit = 2</code>
<code>default-</code><code>time</code><code>-zone = system</code>
<code>default-storage-engine = InnoDB</code>
<code>max_relay_log_size = 1G</code>
<code>innodb_flush_log_at_trx_commit=1</code>
<code>[mysqldump]</code>
<code>quick</code>
<code>max_allowed_packet = 64M</code>
<code>[myisamchk]</code>
<code>key_buffer = 16M</code>
<code>read_buffer = 8M</code>
<code>write_buffer = 8M</code>
<code>[mysqld_safe]</code>
<code>open</code><code>-files-limit = 8192</code>
<code>log-error=</code><code>/opt/3306/mysql_3306</code><code>.err</code>
<code>pid-</code><code>file</code><code>=</code><code>/opt/3306/mysqld</code><code>.pid</code>
<code>從</code>
<code>###read-only</code>
<code>read</code><code>-only</code>
<code>#####slave_skip_errors</code>
<code>slave_skip_errors=off</code>
<code>slow_query_log=1</code>
<code>server-</code><code>id</code> <code>= 2</code>
<code>slave-skip-errors = OFF</code>
<code>#innodb_flush_log_at_trx_commit=0</code>
<code>sync_binlog=0</code>
<code>#replicate-wild-ignore-table =mysql.%</code>
<code>#replicate-wild-ignore-table =test.%</code>
<code>#replicate-wild-ignore-table =log.%</code>
<code>#replicate-wild-ignore-table =information_schema.%</code>
<code>#replicate-wild-ignore-table =performance_schema.%</code>
本文轉自 liqius 51CTO部落格,原文連結:http://blog.51cto.com/szgb17/1793140,如需轉載請自行聯系原作者