MySQL InnoDB千表无法启动服务

标签 mysql

我在使用具有数千个表的 MySQL 数据库时遇到问题

  1. 文件夹数据库大小为 66 GB,包含 16.000 个表,可以启动服务 通常
  2. 当数据库大小为 180 GB、包含 66.000 个表时不能 启动服务

这是我的.ini

[client]
port=3306
[mysql]
no-beep
default-character-set=utf8
[mysqld]
port=3306
datadir=E:/DataMySQLServer/Data
character-set-server=utf8
default-storage-engine=INNODB
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
log-output=FILE
general-log=0
general_log_file="WIN-PN6P4KVFP6B.log"
slow-query-log=1
slow_query_log_file="WIN-PN6P4KVFP6B-slow.log"
long_query_time=10
log-error="WIN-PN6P4KVFP6B.err"
server-id=1
secure-file-priv="E:/DataMySQLServer/Uploads"
max_connections=151
query_cache_size=0
table_open_cache=70000
tmp_table_size=60M
thread_cache_size=10
myisam_max_sort_file_size=100G
myisam_sort_buffer_size=111M
key_buffer_size=8M
read_buffer_size=64K
read_rnd_buffer_size=256K
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M
innodb_buffer_pool_size=3G
innodb_log_file_size=48M
innodb_thread_concurrency=9
innodb_autoextend_increment=64
innodb_buffer_pool_instances=8
innodb_concurrency_tickets=5000
innodb_old_blocks_time=1000
innodb_open_files=300
innodb_stats_on_metadata=0
innodb_file_per_table=1
innodb_checksum_algorithm=0
back_log=80
flush_time=0
join_buffer_size=256K
max_allowed_packet=4M
max_connect_errors=100
open_files_limit=70000
query_cache_type=0
sort_buffer_size=256K
table_definition_cache=1400
binlog_row_event_max_size=8K
sync_master_info=10000
sync_relay_log=10000
sync_relay_log_info=10000

mysql.错误

2018-02-06T14:13:31.328373Z 0 [Warning] TIMESTAMP with implicit DEFAULT 
value is deprecated. Please use --explicit_defaults_for_timestamp server 
option (see documentation for more details).
2018-02-06T14:13:31.338701Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' 
and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. 
They will be merged with strict mode in a future release.
2018-02-06T14:13:31.343938Z 0 [Note] C:\Program Files\MySQL\MySQL Server 
5.7\bin\mysqld.exe (mysqld 5.7.21-log) starting as process 3408 ...
2018-02-06T14:13:31.524790Z 0 [Note] InnoDB: Mutexes and rw_locks use 
Windows interlocked functions
2018-02-06T14:13:31.525769Z 0 [Note] InnoDB: Uses event mutexes
2018-02-06T14:13:31.526446Z 0 [Note] InnoDB: _mm_lfence() and _mm_sfence() 
are used for memory barrier
2018-02-06T14:13:31.526917Z 0 [Note] InnoDB: Compressed tables use zlib 
 1.2.3
2018-02-06T14:13:31.538396Z 0 [Note] InnoDB: Number of pools: 1
2018-02-06T14:13:31.554578Z 0 [Note] InnoDB: Not using CPU crc32 
instructions
2018-02-06T14:13:31.557844Z 0 [Note] InnoDB: Initializing buffer pool, total 
size = 3G, instances = 8, chunk size = 128M
2018-02-06T14:13:31.703384Z 0 [Note] InnoDB: Completed initialization of 
buffer pool
2018-02-06T14:13:31.884100Z 0 [Note] InnoDB: Highest supported file format 
is Barracuda.

为什么无法启动服务?请帮忙...

注意上面的 my.ini 文件,我们更改了一些行,例如 table_open_cache=70000innodb_buffer_pool_size=3Gopen_files_limit=70000

最佳答案

对 my.cnf/ini [mysqld] 部分的建议

#myisam_max_sort_file_size=100G  # lead with # for default until u know what u need
table_open_cache=50000  # from 70000 until you are stable

当table_definition_cache=1400时,你应该在open_files_limit=70000的情况下生存 因为 50000 + 1400 = < 70000。

关于MySQL InnoDB千表无法启动服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48645678/

相关文章:

mysql - 如何将 MySQL 表的唯一行转置为列作为查询

php - 从 mysql 数据库中选择与重复结果相同的行

mysql - 对多种类型的数字和字符进行排序

java - 请求处理失败;嵌套异常是 org.springframework.transaction.CannotCreateTransactionException

mysql - 日期 日期变量

mysql - JPA -表列引用作为两个不同表的外键

Mysql将列数据类型从整数更改为小数(3,2)而不丢失旧数据

php - 如何使用codeigniter在数组中设置用户权限?

php mysql 搜索查询通配符问题

php - WordPress WP_Query 循环似乎与实际查询不同