MySQL 8.0.39 - MySqlException (0x80004005): Out of memory;
0
votes
1
answer
149
views
We have a Windows Server 2022 with **56Gb** RAM. This server is dedicated to MySQL DB and during idle it has ~**50.9Gb** available memory. But while bulk inserting rows (200k rows) into a table from an application I'm facing the following error. Unfortunately, application does not support batch inserts yet.
Message: MySql.Data.MySqlClient.MySqlException (0x80004005): Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
Initially, I tried with default configuration then changed configuration after searching online for the issue and still facing the same error. As insertion query is executed, memory usage increases from ~**4Gb** to **55Gb**+ with MySQL service consuming ~**53Gb**.
Following are the configurations set in my.ini
[mysqld]
default-storage-engine=INNODB
sql-mode="ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
max_connections=200
thread_stack=100M
table_open_cache=10000
temptable_max_ram=5G
tmp_table_size=5G
internal_tmp_mem_storage_engine=TempTable
myisam_max_sort_file_size=2146435072
myisam_sort_buffer_size=6G
key_buffer_size=2048M
read_buffer_size=256M
read_rnd_buffer_size=512M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=256M
innodb_buffer_pool_size=35G
innodb_redo_log_capacity=100M
innodb_thread_concurrency=13
innodb_autoextend_increment=64
innodb_buffer_pool_instances=16
innodb_concurrency_tickets=5000
innodb_old_blocks_time=1000
innodb_stats_on_metadata=0
innodb_file_per_table=1
innodb_checksum_algorithm=0
innodb_lock_wait_timeout=50
innodb_flush_method=normal
flush_time=300
join_buffer_size=256K
max_allowed_packet=1G
max_connect_errors=100
open_files_limit=10000
sort_buffer_size=4G
binlog_row_event_max_size=8K
sync_source_info=10000
sync_relay_log=10000
mysqlx_port=33060
upon checking online for solution, I increased innodb_buffer_pool_size
and key_buffer_size
. I also increased thread_stack
size.
Please suggest If I'm missing any configuration or what configurations need to be adjusted to not get the error when bulk insert (~1M+ rows). Thanks.
Asked by yugck
(1 rep)
Sep 25, 2024, 09:41 AM
Last activity: Jul 23, 2025, 06:04 PM
Last activity: Jul 23, 2025, 06:04 PM