MySQL(MariaDB)错误:内存不足(需要1048584字节)

时间:2018-06-14 10:00:26

标签: mysql

我在Windows 2012 R2上使用MySQL DB,x64使用8 GB RAM。 MySQL数据库多次显示错误 - Out of Memory(需要1048584字节)。下面是我在my.ini文件中设置的数据库变量值。此文件中是否需要进行任何更改?

[mysqld]
port= 3306
socket = "C:/xampp/mysql/mysql.sock"
basedir = "C:/xampp/mysql" 
tmpdir = "C:/xampp/tmp" 
datadir = "C:/xampp/mysql/data"
pid_file = "mysql.pid"

# enable-named-pipe
key_buffer_size = 16M
max_allowed_packet = 256M
table_cache = 256
net_buffer_length = 1M
read_buffer_size = 512K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
log_error = "mysql_error.log"
# Change here for bind listening
# bind-address="127.0.0.1" 
# bind-address = ::1    # for ipv6
max_connect_errors = 500
max_connections = 5000
net_write_timeout = 1800
net_read_timeout = 1800
slow_launch_time = 10
slow_query_log = OFF
thread_cache_size = 2000
back_log = 100
performance_schema = OFF
query_cache_size = 512M
query_cache_limit = 5M
join_buffer_size = 4M
sort_buffer_size = 4M
max_heap_table_size = 64M
tmp_table_size = 128M
table_open_cache = 4500
table_definition_cache=4000
innodb_file_per_table=1
open_files_limit=50000
innodb_data_home_dir = "C:/xampp/mysql/data"
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = "C:/xampp/mysql/data"
#innodb_log_arch_dir = "C:/xampp/mysql/data"
## You can set .._buffer_pool_size up to 50 - 80 %
## of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 2048M
innodb_buffer_pool_instances = 2
## Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 256M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 2
innodb_lock_wait_timeout = 50
innodb_flush_method=O_DIRECT
innodb_io_capacity=1000
innodb_old_blocks_time=1000
innodb_open_files=5000
innodb_sort_buffer_size = 8M

如果有人能够重新开始工作,请回复! 提前谢谢。

1 个答案:

答案 0 :(得分:0)

为my.ini [mysqld]部分考虑的建议

以#(或REMOVE)为首,允许默认为您服务

。的net_buffer_length

。 read_buffer_size

。 read_rnd_buffer_size

。 MyISAM_sort_buffer_size

。 join_buffer_size

。 sort_buffer_size的值

。 innodb_sort_buffer_size

max_connections=500  # from 5000 until you have a known need for more connections
thread_cache_size=100  # from 2000  per v8 refman CAP at 100 to avoid OOM
query_cache_type=0  # to avoid QC overhead
query_cache_size=0  # from 512M to conserve RAM for more useful purpose
query_cache_limit=0  # 0 is fine when not using QC
tmp_table_size=64M  # from 128M until you can monitor created_tmp_disk_tables

tmp_table_size和max_heap_table_size应始终保持相同的大小。

祝你好运。

如需其他帮助,请查看我的个人资料,clk Network Profile获取联系信息。