zoukankan      html  css  js  c++  java
  • 通用 mysql配置

    windows:my.ini

    [mysqld]
    
    # Remove leading # and set to the amount of RAM for the most important data
    # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
    # innodb_buffer_pool_size = 128M
    
    # Remove leading # to turn on a very important data integrity option: logging
    # changes to the binary log between backups.
    # log_bin
    
    # These are commonly set, remove the # and set as required.
    # basedir = .....
    # datadir = .....
    # port = .....
    # server_id = .....
    
    basedir = D:\MySQL5.6
    datadir = D:MySQL5.6\data
    max_connections = 1100
    max_user_connections = 1000
    max_connect_errors = 10000
    max_allowed_packet = 128M
    
    # Remove leading # to set options mainly useful for reporting servers.
    # The server defaults are faster for transactions and fast SELECTs.
    # Adjust sizes as needed, experiment to find the optimal values.
    # join_buffer_size = 128M
    # sort_buffer_size = 2M
    # read_rnd_buffer_size = 2M 
    
    sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
    
    skip_name_resolve = 1
    skip_external_locking = 1 
    lower_case_table_names = 1
    # logs
    long_query_time    = 1
    slow_query_log = 1
    slow_query_log_file = D:\MySQL5.6\logs\slow.log   
    log_error = D:\MySQL5.6\logs\error.log   
    #innodb_force_recovery=1
    # binlog
    binlog_format = row
    log_bin     = D:\MySQL5.6\logs\mysql-bin  
    binlog_cache_size = 8M
    max_binlog_size = 1G
    max_binlog_cache_size = 4G
    expire_logs_days = 5
    log_bin_trust_function_creators = 1
    
    ############ myisam
    key_buffer_size = 64M
    #bulk_insert_buffer_size = 32M
    ########## PGA
    sort_buffer_size = 8M
    read_buffer_size = 8M
    join_buffer_size = 32M
    read_rnd_buffer_size = 32M
    query_cache_type = 0
    query_cache_size = 0M
    table_open_cache = 6144
    table_definition_cache = 4096
    open_files_limit = 65536
    back_log = 512
    
    
    thread_cache_size = 64
    thread_stack=192k
    tmp_table_size=128M
    max_heap_table_size=128M
    
    
    transaction_isolation = READ-COMMITTED
    innodb_data_home_dir = D:MySQL5.6\data    
    innodb_log_group_home_dir = D:MySQL5.6\data
    innodb_data_file_path = ibdata1:12M:autoextend
    innodb_buffer_pool_size = 1G
    innodb_buffer_pool_instances    = 8
    innodb_log_file_size = 1024M
    innodb_log_buffer_size = 64M
    innodb_log_files_in_group = 3
    innodb_flush_log_at_trx_commit = 1
    innodb_lock_wait_timeout = 10
    innodb_sync_spin_loops = 40
    innodb_max_dirty_pages_pct = 80
    innodb_thread_concurrency = 0
    innodb_thread_sleep_delay = 500
    innodb_concurrency_tickets = 1000
    innodb_file_per_table = 1
    innodb_read_io_threads = 20
    innodb_write_io_threads = 20
    innodb_io_capacity = 600
    innodb_file_format = Barracuda
    innodb_purge_threads=1
    innodb_purge_batch_size = 32
    innodb_old_blocks_pct=50
    innodb_stats_on_metadata=0
    
    optimizer_switch='mrr=on,mrr_cost_based=off,batched_key_access=on'
    
    
    [myisamchk]
    key_buffer_size = 64M
    sort_buffer_size = 512k
    read_buffer = 2M
    write_buffer = 2M
    
    
    [mysqldump]
    quick
    max_allowed_packet = 128M
    #myisam_max_sort_file_size = 10G
    
    
    [mysql]
    no-auto-rehash
    max_allowed_packet = 128M
    prompt                         = '(BI154)u@h [10.11.20.31]> '

    linux :my.cnf

    [mysql] 
    prompt = [// aliyunzixun@xxx.com//h][//d]>//_ 
    [mysqld] 
    # basic settings # 
    user = mysql 
    sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER"
    autocommit = 1 
    character_set_server=utf8mb4 
    transaction_isolation = READ-COMMITTED 
    explicit_defaults_for_timestamp = 1 
    max_allowed_packet = 16777216 
    event_scheduler = 1 
    # connection # 
    interactive_timeout = 1800 
    wait_timeout = 1800 
    lock_wait_timeout = 1800 
    skip_name_resolve = 1 
    max_connections = 512 
    max_connect_errors = 1000000 
    # table cache performance settings 
    table_open_cache = 4096 
    table_definition_cache = 4096 
    table_open_cache_instances = 128 
    # session memory settings # 
    read_buffer_size = 16M 
    read_rnd_buffer_size = 32M 
    sort_buffer_size = 32M 
    tmp_table_size = 64M 
    join_buffer_size = 128M 
    thread_cache_size = 64 
    # log settings # 
    log_error = error.log 
    slow_query_log = 1 
    slow_query_log_file = slow.log 
    log_queries_not_using_indexes = 1 
    log_slow_admin_statements = 1 
    log_slow_slave_statements = 1 
    log_throttle_queries_not_using_indexes = 10 
    expire_logs_days = 90 
    long_query_time = 2 
    min_examined_row_limit = 100 
    binlog-rows-query-log-events = 1 
    log-bin-trust-function-creators = 1 
    expire-logs-days = 90 
    log-slave-updates = 1 
    # innodb settings # 
    innodb_page_size = 16384 
    innodb_buffer_pool_size = 160G 
    innodb_buffer_pool_instances = 16 
    innodb_buffer_pool_load_at_startup = 1 
    innodb_buffer_pool_dump_at_shutdown = 1 
    innodb_lru_scan_depth = 4096 
    innodb_lock_wait_timeout = 5 
    innodb_io_capacity = 10000 
    innodb_io_capacity_max = 20000 
    innodb_flush_method = O_DIRECT 
    innodb_file_format = Barracuda 
    innodb_file_format_max = Barracuda 
    innodb_undo_logs = 128 
    innodb_undo_tablespaces = 3 
    innodb_flush_neighbors = 0 
    innodb_log_file_size = 17179869184 
    innodb_log_files_in_group = 2 
    innodb_log_buffer_size = 16777216 
    innodb_purge_threads = 4 
    innodb_large_prefix = 1 
    innodb_thread_concurrency = 64 
    innodb_print_all_deadlocks = 1 
    innodb_strict_mode = 1 
    innodb_sort_buffer_size = 67108864 
    innodb_write_io_threads = 16 
    innodb_read_io_threads = 16 
    innodb_file_per_table = 1 
    innodb_stats_persistent_sample_pages = 64 
    innodb_autoinc_lock_mode = 2 
    innodb_online_alter_log_max_size=1G 
    innodb_open_files=4096 
    # replication settings # 
    master_info_repository = TABLE 
    relay_log_info_repository = TABLE 
    sync_binlog = 1 
    gtid_mode = on 
    enforce_gtid_consistency = 1 
    log_slave_updates 
    binlog_format = ROW 
    binlog_rows_query_log_events = 1 
    relay_log = relay.log 
    relay_log_recovery = 1 
    slave_skip_errors = ddl_exist_errors 
    slave-rows-search-algorithms = 'INDEX_SCAN,HASH_SCAN' 
    # semi sync replication settings # 
    plugin_load = "validate_password.so;rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so" 
    rpl_semi_sync_master_enabled = 1 
    rpl_semi_sync_master_timeout = 3000 
    rpl_semi_sync_slave_enabled = 1 
    # password plugin # 
    validate_password_policy=STRONG 
    validate-password=FORCE_PLUS_PERMANENT 
    [mysqld-5.6] 
    # metalock performance settings 
    metadata_locks_hash_instances=64 
    [mysqld-5.7] 
    # new innodb settings # 
    loose_innodb_numa_interleave=1 
    innodb_buffer_pool_dump_pct = 40 
    innodb_page_cleaners = 16 
    innodb_undo_log_truncate = 1 
    innodb_max_undo_log_size = 2G 
    innodb_purge_rseg_truncate_frequency = 128 
    # new replication settings # 
    slave-parallel-type = LOGICAL_CLOCK 
    slave-parallel-workers = 16 
    slave_preserve_commit_order=1 
    slave_transaction_retries=128 
    # other change settings # 
    binlog_gtid_simple_recovery=1 
    log_timestamps=system 
    show_compatibility_56=on 

  • 相关阅读:
    Python 3学习 ——目录 Json Pickle
    Python 3 学习——函数扩展and迭代器生成器装饰器
    Python 3 学习——深浅拷贝以及函数
    Python 3 学习的第七小节——Linux-Ubuntu
    Python 3 —— 文件操作
    Python 3 学习的第五小节——字符编码与三级菜单实践
    关于PHP代码复用‘traits’的一段代码
    一个将对象彻底冻结的函数
    详解vue-cli脚手架项目-package.json
    关于element-ui日期选择器disabledDate使用心得
  • 原文地址:https://www.cnblogs.com/bestxyl/p/9003016.html
Copyright © 2011-2022 走看看