主要添加这句:sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

    1. [client]
    2. port = 3306
    3. socket =/var/lib/mysql/mysqld.sock
    4. [mysql]
    5. no-auto-rehash
    6. [mysqld]
    7. port = 3306
    8. datadir = /var/lib/mysql
    9. socket = /var/lib/mysql/mysqld.sock
    10. log-error = /var/lib/mysql/error.log
    11. pid-file = /var/lib/mysql/mysqld.pid
    12. skip_name_resolve = 1
    13. default_time_zone = "+8:00"
    14. character-set-server = utf8mb4
    15. collation-server = utf8mb4_general_ci
    16. init_connect='SET NAMES utf8mb4'
    17. lower_case_table_names = 1
    18. transaction_isolation = READ-COMMITTED
    19. explicit_defaults_for_timestamp = true
    20. open_files_limit = 65535
    21. max_connections = 300
    22. max_connect_errors = 600
    23. back_log = 110
    24. table_open_cache = 600
    25. table_definition_cache = 700
    26. table_open_cache_instances = 64
    27. thread_stack = 512K
    28. external-locking = FALSE
    29. max_allowed_packet = 128M
    30. sort_buffer_size = 4M
    31. join_buffer_size = 4M
    32. thread_cache_size = 20
    33. interactive_timeout = 1800
    34. wait_timeout = 1800
    35. lock_wait_timeout = 3600
    36. tmp_table_size = 64M
    37. max_heap_table_size = 64M
    38. server-id = 110
    39. log-bin=mysql-bin
    40. binlog_format = ROW
    41. binlog_row_image = FULL
    42. binlog_expire_logs_seconds = 1209600
    43. master_info_repository = TABLE
    44. relay_log_info_repository = TABLE
    45. log_slave_updates
    46. relay_log_recovery = 1
    47. slave_skip_errors = ddl_exist_errors
    48. innodb_flush_log_at_trx_commit = 1
    49. sync_binlog = 1
    50. binlog_cache_size = 4M
    51. max_binlog_cache_size = 2G
    52. max_binlog_size = 1G
    53. gtid_mode = on
    54. enforce_gtid_consistency = 1
    55. key_buffer_size = 15M
    56. read_buffer_size = 8M
    57. read_rnd_buffer_size = 4M
    58. bulk_insert_buffer_size = 64M
    59. innodb_thread_concurrency = 0
    60. innodb_buffer_pool_size = 8G
    61. innodb_buffer_pool_instances = 4
    62. innodb_buffer_pool_load_at_startup = 1
    63. innodb_buffer_pool_dump_at_shutdown = 1
    64. innodb_data_file_path = ibdata1:1G:autoextend
    65. innodb_log_buffer_size = 32M
    66. innodb_log_files_in_group = 3
    67. innodb_log_file_size = 2G
    68. innodb_undo_log_truncate = 1
    69. innodb_max_undo_log_size = 4G
    70. innodb_io_capacity = 4000
    71. innodb_io_capacity_max = 8000
    72. innodb_flush_sync = 0
    73. innodb_flush_neighbors = 0
    74. innodb_write_io_threads = 8
    75. innodb_read_io_threads = 8
    76. innodb_purge_threads = 4
    77. innodb_page_cleaners = 4
    78. innodb_open_files = 65535
    79. innodb_max_dirty_pages_pct = 50
    80. innodb_flush_method = O_DIRECT
    81. innodb_lru_scan_depth = 4000
    82. innodb_checksum_algorithm = crc32
    83. innodb_lock_wait_timeout = 20
    84. innodb_rollback_on_timeout = 1
    85. innodb_print_all_deadlocks = 1
    86. innodb_sort_buffer_size = 67108864
    87. innodb_autoinc_lock_mode = 1
    88. innodb_file_per_table = 1
    89. innodb_online_alter_log_max_size = 4G
    90. sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
    91. #--###########################-- innodb性能设置 结束 --##########################################
    92. [mysqldump]
    93. quick
    94. max_allowed_packet = 128M