记录日常工作关于系统运维,虚拟化云计算,数据库,网络安全等各方面问题。

MySQL 5.7 快速导入导出大SQL文件及简单参数调优


文章声明:此文基于木子实操撰写
生产环境:CentOS Linux release 7.9.2009 (Core),mysql Ver 14.14 Distrib 5.7.33
问题关键字:MySQL 5.7 快速导入导出大SQL文件及简单参数调优

前述

昨天的发文《CentOS 7.9安装与配置MySQL 5.7》是为了今天测试环境而部署,但遇到一个迁移数据库,大家都会遇到的问题,导入、导出大文件数据库慢问题,
尝试了很多种方法,最终发现这种方法最管用,先做一个总结性的输出。
47GB SQL文件从阿里云RDS导出至公司机房花费4小时左右,每秒钟大约3.3MB/s,也就是47*1024/240/60*8=26.72/Mbps/s(因公司机房带宽总共50Mbps,
为防止影响其它业务限制了单节点下载速度,所以正常如果你的带宽够大,下载的速度应该更快。)
再将47GB SQL文件导入数据库服务器,整个花费3.5小时左右,导入完成以后,整个数据量为:116GB(服务器配置:16C64G)

快速导出

参考说明:
-q: 直接转存
-t: 不写表创建信息(这里需要注意,因为导出的时候没有导出表创建信息,所以在导入的时候,必须先导入表结构,再导入数据,不然会直接报错)
--single-transaction: 参数的作用,设置事务的隔离级别为可重复读,即REPEATABLE READ,这样能保证在一个事务中所有相同的查询读取到同样的数据,也就大概保证了在dump期间,如果其他innodb引擎的线程修改了表的数据并提交,对该dump线程的数据并无影响,在这期间不会锁表。此参数需要InnoDB引擎支持,目前MySQL 5.7默认采用InnoDB引擎。
--set-gtid-purged: 因为木子是从阿里云RDS只读库导出(MySQL集群),所以需要添加这个参数,不然会出现警告信息,主要原因在于:在MySQL5.6以后,加入了全局事务ID(GTID)来强化数据库的主备一致性、故障恢复、以及容错能力。

# 未开启GTID的MySQL导出
nohup mysqldump -uxxx -pxxx -q -e -t --single-transaction db_name > /db_name.sql &

# 开启GTID的MySQL导出,如果不添加--set-gtid-purged=OFF警告
Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all transactions, even those that changed suppressed parts of the database. 
If you don't want to restore GTIDs, pass --set-gtid-purged=OFF. To make a complete dump, pass --all-databases --triggers --routines --events

# 导入时错误
ERROR 1840 (HY000) at line 24: @@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUTED is empty.

# 如果你已经导出来GTID的SQL,又不想重新再去导出,可以使用以下方法导入:
mysql> reset slave all;
mysql> reset master;
mysql> source /db_name.sql

# 开启GTID的MySQL导出
nohup mysqldump -uxxx -pxxx -q -e -t --single-transaction --set-gtid-purged=OFF db_name > /db_name.sql &

快速导入参数说明

如果你不想了解整个操作过程,可以跳过此段,直接进入[开始导入数据]。以下参数对于MySQL性能优化有很大帮助,这里简单说一下木子在/etc/my.cnf中配置的参考,详细如下所示:

innodb_buffer_pool_size: 默认大小为128M,用于缓存索引和数据的内存大小,这个当然是越大越好,数据读写在内存中非常快,减少了对磁盘的读写。
当数据提交或满足检查点(checkpoint)条件后才一次性将内存数据刷新到磁盘中。然而内存还有操作系统或数据库其他进程使用,
根据经验推荐设置innodb-buffer-pool-size为服务器总可用内存的75%。 若设置不当,内存使用可能浪费或者使用过多。
对于繁忙的服务器,buffer pool将划分为多个实例以提高系统并发性,减少线程间读写缓存的争用。buffer pool的大小首先受innodb_buffer_pool_instances影响,当然影响较小。

sync_binlog: 这个参数是对于MySQL系统来说是至关重要的,他不仅影响到Binlog对MySQL所带来的性能损耗,而且还影响到MySQL中数据的完整性。
对于“sync_binlog”参数的各种设置的说明如下:

  • sync_binlog=0,当事务提交之后,MySQL不做fsync之类的磁盘同步指令刷新binlog_cache中的信息到磁盘,而让Filesystem自行决定什么时候来做同步,或者cache满了之后才同步到磁盘。
  • sync_binlog=1,每一次事务都提交,保证高一致性、安全性,但性能损耗也是最大的。(阿里云RDS默认值)
  • sync_binlog=n,当每进行n次事务提交之后,MySQL将进行一次fsync之类的磁盘同步指令来将binlog_cache中的数据强制写入磁盘。

在MySQL中系统默认的设置是sync_binlog=0,也就是不做任何强制性的磁盘刷新指令,这时候的性能是最好的,但是风险也是最大的。
因为一旦系统故障,在binlog_cache中的所有binlog信息都会被丢失。而当设置为“1”的时候,是最安全但是性能损耗最大的设置。
因为当设置为1的时候,即使系统故障,也最多丢失binlog_cache中未完成的一个事务,对实际数据没有任何实质性影响,
就是对写入性能影响太大,binlog虽然是顺序IO,多个事务同时提交,同样很大的影响MySQL和IO性能。虽然可以通过group commit的补丁缓解,但是刷新的频率过高对IO的影响也非常大。
对于高并发事务的系统来说,sync_binlog设置为0和设置为1的系统写入性能差距可能高达5倍甚至更多。
阿里云RDS默认sync_binlog为1,很多MySQL DBA设置的sync_binlog并不是最安全的1,而是100、1000 或者是0。这样牺牲一定的一致性,可以获得更高的并发和吞吐量!

innodb_log_file_size: 日志文件大小,即:ib_logfile0ib_logfile1大小,如果你的innodb_log_files_in_group值为默认,就只会存在两个log file文件。
如果参数innodb_log_file_size设置太小,就会导致MySQL的日志文件(redo log)频繁切换,频繁的触发数据库的检查点(Checkpoint),导致刷新脏页(dirty page)到磁盘的次数增加。
从而影响IO性能。另外,如果有一个大的事务,把所有的日志文件写满了,还没有写完,这样就会导致日志不能切换(因为实例恢复还需要,不能被循环复写,
好比Oracle中的redo log无法循环覆盖)这样MySQL就Hang住了。
如果参数innodb_log_file_size设置太大的话,虽然大大提升了IO性能,但是当MySQL由于意外(断电,OOM-Kill等)宕机时,二进制日志很大,
那么恢复的时间必然很长。而且这个恢复时间往往不可控,受多方面因素影响,所以必须权衡二者进行综合考虑。

innodb_log_buffer_size: 控制日志缓冲区的大小,通常不需要把日志缓冲区设置得非常大。推荐的范围是1MB~8MB,一般来说是足够了,MySQL默认是8MB。

innodb_write_io_threads、innodb_read_io_threads: InnoDB使用后台线程处理数据页上读写IO请求的数量,这个值与服务器的CPU相关,
因为木子这里是16C,而且我的大部份是写入,所以将innodb_write_io_threads设置成12,innodb_read_io_threads设置成4,以提高对应写入能力。

innodb_flush_log_at_trx_commit: MySQL支持用户自定义在commit时如何将log buffer中的日志刷到log file中。
这种控制通过变量:innodb_flush_log_at_trx_commit 来决定,该变量有:0、1、2三种值,默认值为1。注意,这个变量只是控制commit动作是否刷新log buffer到磁盘中。

  • 设置为0,将日志缓冲写入到日志文件,并且每秒钟写盘一次,但是事务提交时不做任何事。在这种情况下,MySQL性能最好,但如果mysqld进程崩溃,通常会导致最后1s的日志丢失。[性能最好,最不安全]
  • 设置为1,将日志缓冲写入到日志文件,并且每次事务提交都进行写盘操作。这是默认的设置,该设置能保证不会丢失任何已经提交的事务。(阿里云RDS默认值) [性能最差,最安全]
  • 设置为2,每次事务提交时把日志缓冲写到日志文件,但不写盘,由存储引擎的main_thread每秒将日志写入磁盘。这时如果mysqld进程崩溃,由于日志已经写入到系统缓存,所以并不会丢失数据;在操作系统崩溃的情况下,通常会导致最后1s的日志丢失。[中合]

上面说到的 [最后 1s] 并不是绝对的,有的时候会丢失更多数据。有时候由于调度的问题,每秒刷写(once-per-second flushing)并不能保证100%执行。对于一些数据一致性和完整性要求不高的应用,配置为2就足够了;如果为了最高性能,可以设置为0。有些应用,如支付服务,对一致性和完整性要求很高,所以即使最慢,也最好设置为1。目前所说的双一模式,实际就是innodb_flush_log_at_trx_commitsync_binlog都设置为1,这也是最安全的,在mysqld服务崩溃或者服务器主机故障的情况下,binary log只有可能丢失最多一个语句或者一个事务。

但是鱼与熊掌不可兼得,双一模式由于会导致频繁的IO操作,因此该模式也是最慢的一种方式。

innodb_thread_concurrency: 默认是0,则表示没有并发线程数限制,所有请求都会直接请求线程执行。注意:当innodb_thread_concurrency设置为0时,则innodb_thread_sleep_delay的设置将会被忽略不起作用。如果数据库没出现性能问题时,使用默认值即可。

innodb_log_files_in_group: 控制日志文件数量,默认为2个,mysql事务日志文件是循环覆写的,当一个日志文件写满后,innodb会自动切换到另一个日志文件,而且会触发数据库的checkpoint,这回导致innodb缓存脏页的小批量刷新,会明显降低innodb的性能。

如果innodb_log_file_size设置太小,就会导致innodb频繁地checkpoint,导致性能降低。而如果设置较大,由于事务日志是顺序IO,大大提高了IO性能,但是在崩溃恢复InnoDB时,会导致恢复时间变长。如果InnoDB数据表有频繁的写操作,那么选择合适的innodb_log_file_size值对提升MySQL性能很重要。

max_allowed_packet: MySQL根据配置文件会限制Server接受的数据包大小,大的插入和更新会受max_allowed_packet参数限制,导致大数据写入或者更新失败。

开始导入数据

根据上面的这些参数说明,木子在恢复数据库的时候,采用了以下参数设置:

vi /etc/my.cnf
innodb_buffer_pool_size = 48G
innodb_log_buffer_size = 32M
innodb_log_file_size = 4G
innodb_flush_log_at_trx_commit = 2
innodb_write_io_threads = 12
innodb_read_io_threads = 4
innodb_log_files_in_group = 3
max_allowed_packet = 10M

数据恢复完成,转测试环境后(测试环境大部份数据为读操作),修改参数配置如下:

vi /etc/my.cnf
innodb_buffer_pool_size = 48G
innodb_log_buffer_size = 8M
innodb_log_file_size = 4G
innodb_flush_log_at_trx_commit = 2
sync_binlog = 100
innodb_write_io_threads = 4
innodb_read_io_threads = 12
innodb_log_files_in_group = 2
max_allowed_packet = 10M

注: MySQL 5.7版本以后可以动态修改参数,但是也要修改配置文件参数,防止重启之后,参数又变成配置文件内的参数,

MySQL 5.7以下的版本为静态参数,需要修改配置文件,并重新启动MySQL服务生效配置。

进入数据库,关闭日志、关闭自动提交、关闭主键和唯一键检查,开始导入,需要注意的是对应动态修改只对当前会话生效。

# 创建数据库
create database db_name CHARACTER SET utf8 COLLATE utf8_general_ci;
# 进入数据库
use db_name;
# 关闭日志
set sql_log_bin=off;
# 关闭自动提交
set autocommit=0;
# 关闭主键和唯一键检查
set unique_checks=0;

# 确保已经关闭
show VARIABLES like 'sql_log_bin';
show VARIABLES like 'autocommit';
show VARIABLES like 'UNIQUE_CHECKS';

# 开启事务
start transaction;

# 引入SQL文件
source /xxx.sql

# 成功后提交事务
commit;

# 完成恢复,退出
exit

修改配置参数
采用 set GLOBAL 命令,如:set GLOBAL net_write_timeout=120;
在Mysql的配置文件中对参数值进行修改,之后重启数据库服务即可
 


查看配置参数
命令:show global variables;
如表所示 
Variable_name Value
activate_all_roles_on_login OFF
auto_generate_certs ON
auto_increment_increment 1
auto_increment_offset 1
autocommit ON
automatic_sp_privileges ON
avoid_temporal_upgrade OFF
back_log 80
basedir C:\Program Files\MySQL\MySQL Server 8.0\
big_tables OFF
bind_address *
binlog_cache_size 32768
binlog_checksum CRC32
binlog_direct_non_transactional_updates OFF
binlog_error_action ABORT_SERVER
binlog_expire_logs_seconds 2592000
binlog_format ROW
binlog_group_commit_sync_delay 0
binlog_group_commit_sync_no_delay_count 0
binlog_gtid_simple_recovery ON
binlog_max_flush_queue_time 0
binlog_order_commits ON
binlog_row_image FULL
binlog_row_metadata MINIMAL
binlog_row_value_options  
binlog_rows_query_log_events OFF
binlog_stmt_cache_size 32768
binlog_transaction_dependency_history_size 25000
binlog_transaction_dependency_tracking COMMIT_ORDER
block_encryption_mode aes-128-ecb
bulk_insert_buffer_size 8388608
caching_sha2_password_auto_generate_rsa_keys ON
caching_sha2_password_private_key_path private_key.pem
caching_sha2_password_public_key_path public_key.pem
character_set_client utf8mb4
character_set_connection utf8mb4
character_set_database utf8mb4
character_set_filesystem binary
character_set_results utf8mb4
character_set_server utf8mb4
character_set_system utf8
character_sets_dir C:\Program Files\MySQL\MySQL Server 8.0\share\charsets\
check_proxy_users OFF
collation_connection utf8mb4_0900_ai_ci
collation_database utf8mb4_0900_ai_ci
collation_server utf8mb4_0900_ai_ci
completion_type NO_CHAIN
concurrent_insert AUTO
connect_timeout 10
core_file OFF
cte_max_recursion_depth 1000
datadir D:\ProgramData\MySQL\MySQL Server 8.0\Data\
default_authentication_plugin caching_sha2_password
default_collation_for_utf8mb4 utf8mb4_0900_ai_ci
default_password_lifetime 0
default_storage_engine InnoDB
default_tmp_storage_engine InnoDB
default_week_format 0
delay_key_write ON
delayed_insert_limit 100
delayed_insert_timeout 300
delayed_queue_size 1000
disabled_storage_engines  
disconnect_on_expired_password ON
div_precision_increment 4
end_markers_in_json OFF
enforce_gtid_consistency OFF
eq_range_index_dive_limit 200
event_scheduler ON
expire_logs_days 0
explicit_defaults_for_timestamp ON
flush OFF
flush_time 0
foreign_key_checks ON
ft_boolean_syntax + -><()~*:""&|
ft_max_word_len 84
ft_min_word_len 4
ft_query_expansion_limit 20
ft_stopword_file (built-in)
general_log OFF
general_log_file NBSP.log
group_concat_max_len 1024
gtid_executed 384632e4-e18f-11e8-a8b6-00163e2e5672:1-198655,
385a0fee-e18f-11e8-a276-00163e10a665:1-34714384
gtid_executed_compression_period 1000
gtid_mode OFF
gtid_owned  
gtid_purged 384632e4-e18f-11e8-a8b6-00163e2e5672:1-198655,
385a0fee-e18f-11e8-a276-00163e10a665:1-34714384
have_compress YES
have_dynamic_loading YES
have_geometry YES
have_openssl YES
have_profiling YES
have_query_cache NO
have_rtree_keys YES
have_ssl YES
have_statement_timeout YES
have_symlink DISABLED
histogram_generation_max_mem_size 20000000
host_cache_size 279
hostname nbsp
information_schema_stats_expiry 86400
init_connect  
init_file  
init_slave  
innodb_adaptive_flushing ON
innodb_adaptive_flushing_lwm 10
innodb_adaptive_hash_index ON
innodb_adaptive_hash_index_parts 8
innodb_adaptive_max_sleep_delay 150000
innodb_api_bk_commit_interval 5
innodb_api_disable_rowlock OFF
innodb_api_enable_binlog OFF
innodb_api_enable_mdl OFF
innodb_api_trx_level 0
innodb_autoextend_increment 64
innodb_autoinc_lock_mode 2
innodb_buffer_pool_chunk_size 8388608
innodb_buffer_pool_dump_at_shutdown ON
innodb_buffer_pool_dump_now OFF
innodb_buffer_pool_dump_pct 25
innodb_buffer_pool_filename ib_buffer_pool
innodb_buffer_pool_instances 1
innodb_buffer_pool_load_abort OFF
innodb_buffer_pool_load_at_startup ON
innodb_buffer_pool_load_now OFF
innodb_buffer_pool_size 8388608
innodb_change_buffer_max_size 25
innodb_change_buffering all
innodb_checksum_algorithm crc32
innodb_cmp_per_index_enabled OFF
innodb_commit_concurrency 0
innodb_compression_failure_threshold_pct 5
innodb_compression_level 6
innodb_compression_pad_pct_max 50
innodb_concurrency_tickets 5000
innodb_data_file_path ibdata1:12M:autoextend
innodb_data_home_dir  
innodb_deadlock_detect ON
innodb_dedicated_server OFF
innodb_default_row_format dynamic
innodb_directories  
innodb_disable_sort_file_cache OFF
innodb_doublewrite ON
innodb_fast_shutdown 1
innodb_file_per_table ON
innodb_fill_factor 100
innodb_flush_log_at_timeout 1
innodb_flush_log_at_trx_commit 1
innodb_flush_method unbuffered
innodb_flush_neighbors 0
innodb_flush_sync ON
innodb_flushing_avg_loops 30
innodb_force_load_corrupted OFF
innodb_force_recovery 0
innodb_ft_aux_table  
innodb_ft_cache_size 8000000
innodb_ft_enable_diag_print OFF
innodb_ft_enable_stopword ON
innodb_ft_max_token_size 84
innodb_ft_min_token_size 3
innodb_ft_num_word_optimize 2000
innodb_ft_result_cache_limit 2000000000
innodb_ft_server_stopword_table  
innodb_ft_sort_pll_degree 2
innodb_ft_total_cache_size 640000000
innodb_ft_user_stopword_table  
innodb_io_capacity 200
innodb_io_capacity_max 2000
innodb_lock_wait_timeout 50
innodb_log_buffer_size 1048576
innodb_log_checksums ON
innodb_log_compressed_pages ON
innodb_log_file_size 50331648
innodb_log_files_in_group 2
innodb_log_group_home_dir .\
innodb_log_spin_cpu_abs_lwm 80
innodb_log_spin_cpu_pct_hwm 50
innodb_log_wait_for_flush_spin_hwm 400
innodb_log_write_ahead_size 8192
innodb_lru_scan_depth 1024
innodb_max_dirty_pages_pct 90.000000
innodb_max_dirty_pages_pct_lwm 10.000000
innodb_max_purge_lag 0
innodb_max_purge_lag_delay 0
innodb_max_undo_log_size 1073741824
innodb_monitor_disable  
innodb_monitor_enable  
innodb_monitor_reset  
innodb_monitor_reset_all  
innodb_old_blocks_pct 37
innodb_old_blocks_time 1000
innodb_online_alter_log_max_size 134217728
innodb_open_files 300
innodb_optimize_fulltext_only OFF
innodb_page_cleaners 1
innodb_page_size 16384
innodb_print_all_deadlocks OFF
innodb_print_ddl_logs OFF
innodb_purge_batch_size 300
innodb_purge_rseg_truncate_frequency 128
innodb_purge_threads 4
innodb_random_read_ahead OFF
innodb_read_ahead_threshold 56
innodb_read_io_threads 4
innodb_read_only OFF
innodb_redo_log_encrypt OFF
innodb_replication_delay 0
innodb_rollback_on_timeout OFF
innodb_rollback_segments 128
innodb_sort_buffer_size 1048576
innodb_spin_wait_delay 6
innodb_stats_auto_recalc ON
innodb_stats_include_delete_marked OFF
innodb_stats_method nulls_equal
innodb_stats_on_metadata OFF
innodb_stats_persistent ON
innodb_stats_persistent_sample_pages 20
innodb_stats_transient_sample_pages 8
innodb_status_output OFF
innodb_status_output_locks OFF
innodb_strict_mode ON
innodb_sync_array_size 1
innodb_sync_spin_loops 30
innodb_table_locks ON
innodb_temp_data_file_path ibtmp1:12M:autoextend
innodb_thread_concurrency 25
innodb_thread_sleep_delay 0
innodb_tmpdir  
innodb_undo_directory .\
innodb_undo_log_encrypt OFF
innodb_undo_log_truncate ON
innodb_undo_tablespaces 2
innodb_use_native_aio ON
innodb_version 8.0.12
innodb_write_io_threads 4
interactive_timeout 28800
internal_tmp_disk_storage_engine InnoDB
internal_tmp_mem_storage_engine TempTable
join_buffer_size 262144
keep_files_on_create OFF
key_buffer_size 8388608
key_cache_age_threshold 300
key_cache_block_size 1024
key_cache_division_limit 100
keyring_operations ON
large_files_support ON
large_page_size 0
large_pages OFF
lc_messages en_US
lc_messages_dir C:\Program Files\MySQL\MySQL Server 8.0\share\
lc_time_names en_US
license GPL
local_infile OFF
lock_wait_timeout 31536000
log_bin ON
log_bin_basename D:\ProgramData\MySQL\MySQL Server 8.0\Data\binlog
log_bin_index D:\ProgramData\MySQL\MySQL Server 8.0\Data\binlog.index
log_bin_trust_function_creators OFF
log_bin_use_v1_row_events OFF
log_error .\NBSP.err
log_error_services log_filter_internal; log_sink_internal
log_error_verbosity 2
log_output FILE
log_queries_not_using_indexes OFF
log_slave_updates ON
log_slow_admin_statements OFF
log_slow_slave_statements OFF
log_statements_unsafe_for_binlog ON
log_syslog ON
log_syslog_tag  
log_throttle_queries_not_using_indexes 0
log_timestamps UTC
long_query_time 10.000000
low_priority_updates OFF
lower_case_file_system ON
lower_case_table_names 1
mandatory_roles  
master_info_repository TABLE
master_verify_checksum OFF
max_allowed_packet 4194304
max_binlog_cache_size 18446744073709547520
max_binlog_size 1073741824
max_binlog_stmt_cache_size 18446744073709547520
max_connect_errors 100
max_connections 151
max_delayed_threads 20
max_digest_length 1024
max_error_count 1024
max_execution_time 0
max_heap_table_size 16777216
max_insert_delayed_threads 20
max_join_size 18446744073709551615
max_length_for_sort_data 4096
max_points_in_geometry 65536
max_prepared_stmt_count 16382
max_relay_log_size 0
max_seeks_for_key 4294967295
max_sort_length 1024
max_sp_recursion_depth 0
max_user_connections 0
max_write_lock_count 4294967295
metadata_locks_cache_size 1024
metadata_locks_hash_instances 8
min_examined_row_limit 0
myisam_data_pointer_size 6
myisam_max_sort_file_size 107374182400
myisam_mmap_size 18446744073709551615
myisam_recover_options OFF
myisam_repair_threads 1
myisam_sort_buffer_size 8388608
myisam_stats_method nulls_unequal
myisam_use_mmap OFF
mysql_native_password_proxy_users OFF
mysqlx_bind_address *
mysqlx_connect_timeout 30
mysqlx_document_id_unique_prefix 0
mysqlx_idle_worker_thread_timeout 60
mysqlx_interactive_timeout 28800
mysqlx_max_allowed_packet 67108864
mysqlx_max_connections 100
mysqlx_min_worker_threads 2
mysqlx_port 33060
mysqlx_port_open_timeout 0
mysqlx_read_timeout 30
mysqlx_socket /tmp/mysqlx.sock
mysqlx_ssl_ca  
mysqlx_ssl_capath  
mysqlx_ssl_cert  
mysqlx_ssl_cipher  
mysqlx_ssl_crl  
mysqlx_ssl_crlpath  
mysqlx_ssl_key  
mysqlx_wait_timeout 28800
mysqlx_write_timeout 60
named_pipe OFF
net_buffer_length 16384
net_read_timeout 30
net_retry_count 10
net_write_timeout 60
new OFF
ngram_token_size 2
offline_mode OFF
old OFF
old_alter_table OFF
open_files_limit 6209
optimizer_prune_level 1
optimizer_search_depth 62
optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=off,materialization=on,semijoin=on,loosescan=on,firstmatch=on,duplicateweedout=on,subquery_materialization_cost_based=on,use_index_extensions=on,condition_fanout_filter=on,derived_merge=on,use_invisible_indexes=off
optimizer_trace enabled=off,one_line=off
optimizer_trace_features greedy_search=on,range_optimizer=on,dynamic_range=on,repeated_subselect=on
optimizer_trace_limit 1
optimizer_trace_max_mem_size 1048576
optimizer_trace_offset -1
parser_max_mem_size 18446744073709551615
password_history 0
password_reuse_interval 0
performance_schema ON
performance_schema_accounts_size -1
performance_schema_digests_size 10000
performance_schema_error_size 4392
performance_schema_events_stages_history_long_size 10000
performance_schema_events_stages_history_size 10
performance_schema_events_statements_history_long_size 10000
performance_schema_events_statements_history_size 10
performance_schema_events_transactions_history_long_size 10000
performance_schema_events_transactions_history_size 10
performance_schema_events_waits_history_long_size 10000
performance_schema_events_waits_history_size 10
performance_schema_hosts_size -1
performance_schema_max_cond_classes 80
performance_schema_max_cond_instances -1
performance_schema_max_digest_length 1024
performance_schema_max_digest_sample_age 60
performance_schema_max_file_classes 80
performance_schema_max_file_handles 32768
performance_schema_max_file_instances -1
performance_schema_max_index_stat -1
performance_schema_max_memory_classes 450
performance_schema_max_metadata_locks -1
performance_schema_max_mutex_classes 300
performance_schema_max_mutex_instances -1
performance_schema_max_prepared_statements_instances -1
performance_schema_max_program_instances -1
performance_schema_max_rwlock_classes 60
performance_schema_max_rwlock_instances -1
performance_schema_max_socket_classes 10
performance_schema_max_socket_instances -1
performance_schema_max_sql_text_length 1024
performance_schema_max_stage_classes 150
performance_schema_max_statement_classes 212
performance_schema_max_statement_stack 10
performance_schema_max_table_handles -1
performance_schema_max_table_instances -1
performance_schema_max_table_lock_stat -1
performance_schema_max_thread_classes 100
performance_schema_max_thread_instances -1
performance_schema_session_connect_attrs_size 512
performance_schema_setup_actors_size -1
performance_schema_setup_objects_size -1
performance_schema_users_size -1
persisted_globals_load ON
pid_file D:\ProgramData\MySQL\MySQL Server 8.0\Data\nbsp.pid
plugin_dir C:\Program Files\MySQL\MySQL Server 8.0\lib\plugin\
port 3306
preload_buffer_size 32768
profiling OFF
profiling_history_size 15
protocol_version 10
query_alloc_block_size 8192
query_prealloc_size 8192
range_alloc_block_size 4096
range_optimizer_max_mem_size 8388608
rbr_exec_mode STRICT
read_buffer_size 8192
read_only OFF
read_rnd_buffer_size 1
regexp_stack_limit 8000000
regexp_time_limit 32
relay_log nbsp-relay-bin
relay_log_basename D:\ProgramData\MySQL\MySQL Server 8.0\Data\nbsp-relay-bin
relay_log_index D:\ProgramData\MySQL\MySQL Server 8.0\Data\nbsp-relay-bin.index
relay_log_info_file relay-log.info
relay_log_info_repository TABLE
relay_log_purge ON
relay_log_recovery OFF
relay_log_space_limit 0
report_host  
report_password  
report_port 3306
report_user  
require_secure_transport OFF
rpl_read_size 8192
rpl_stop_slave_timeout 31536000
schema_definition_cache 256
secure_file_priv C:\ProgramData\MySQL\MySQL Server 8.0\Uploads\
server_id 1
server_id_bits 32
server_uuid fab2a9d1-d297-11e8-b80b-8cec4b9844c0
session_track_gtids OFF
session_track_schema ON
session_track_state_change OFF
session_track_system_variables time_zone,autocommit,character_set_client,character_set_results,character_set_connection
session_track_transaction_info OFF
sha256_password_auto_generate_rsa_keys ON
sha256_password_private_key_path private_key.pem
sha256_password_proxy_users OFF
sha256_password_public_key_path public_key.pem
shared_memory OFF
shared_memory_base_name MYSQL
show_create_table_verbosity OFF
show_old_temporals OFF
skip_external_locking ON
skip_name_resolve OFF
skip_networking OFF
skip_show_database OFF
slave_allow_batching OFF
slave_checkpoint_group 512
slave_checkpoint_period 300
slave_compressed_protocol OFF
slave_exec_mode STRICT
slave_load_tmpdir C:\windows\SERVIC~3\NETWOR~1\AppData\Local\Temp
slave_max_allowed_packet 1073741824
slave_net_timeout 60
slave_parallel_type DATABASE
slave_parallel_workers 0
slave_pending_jobs_size_max 134217728
slave_preserve_commit_order OFF
slave_rows_search_algorithms INDEX_SCAN,HASH_SCAN
slave_skip_errors OFF
slave_sql_verify_checksum ON
slave_transaction_retries 10
slave_type_conversions  
slow_launch_time 2
slow_query_log ON
slow_query_log_file NBSP-slow.log
socket MySQL
sort_buffer_size 262144
sql_auto_is_null OFF
sql_big_selects ON
sql_buffer_result OFF
sql_log_off OFF
sql_mode STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION
sql_notes ON
sql_quote_show_create ON
sql_safe_updates OFF
sql_select_limit 18446744073709551615
sql_slave_skip_counter 0
sql_warnings OFF
ssl_ca ca.pem
ssl_capath  
ssl_cert server-cert.pem
ssl_cipher  
ssl_crl  
ssl_crlpath  
ssl_fips_mode OFF
ssl_key server-key.pem
stored_program_cache 256
stored_program_definition_cache 256
super_read_only OFF
sync_binlog 1
sync_master_info 10000
sync_relay_log 10000
sync_relay_log_info 10000
system_time_zone  
table_definition_cache 1400
table_open_cache 2000
table_open_cache_instances 16
tablespace_definition_cache 256
temptable_max_ram 1073741824
thread_cache_size 10
thread_handling one-thread-per-connection
thread_stack 286720
time_zone SYSTEM
tls_version TLSv1,TLSv1.1,TLSv1.2
tmp_table_size 16777216
tmpdir C:\windows\SERVIC~3\NETWOR~1\AppData\Local\Temp
transaction_alloc_block_size 8192
transaction_isolation REPEATABLE-READ
transaction_prealloc_size 4096
transaction_read_only OFF
transaction_write_set_extraction XXHASH64
unique_checks ON
updatable_views_with_limit YES
version 8.0.12
version_comment MySQL Community Server - GPL
version_compile_machine x86_64
version_compile_os Win64
version_compile_zlib 1.2.11
wait_timeout 28800
windowing_use_high_precision ON
————————————————
 



转载请标明出处【MySQL 5.7 快速导入导出大SQL文件及简单参数调优】。

《www.micoder.cc》 虚拟化云计算,系统运维,安全技术服务.

网站已经关闭评论