MySQL running out of memory I am running a VPS with 1024 mb ram that is hosting a single WordPress site. Lately I have been having a lot of database problems where WordPress is giving me "Error establishing a database connection". I can make the server crash just by crawling it with Screaming Frog SEO tool.

Sometimes the issue resolves itself, sometimes I need to manually restart MySQL, and other times I have to completely reboot the server.

I thought the error was related to MySQL itself, but after examining the various logs, it seems like my server is running out of memory and therefore simply killing MySQL.

Using MySqltuner, I am getting the following results:

[--] Physical Memory     : 992.6M
[--] Max MySQL memory    : 804.0M
[--] Other process memory: 306.2M
[--] Total buffers: 225.0M global + 1.1M per thread (151 max threads)
[--] P_S Max memory usage: 409M
[--] Galera GCache Max memory usage: 0B
[OK] Maximum reached memory usage: 643.1M (64.79% of installed RAM)
[OK] Maximum possible memory usage: 804.0M (80.99% of installed RAM)
[!!] Overall possible memory usage with other process exceeded memory


Settings in my.cnf:

[mysqld]
max_allowed_packet=268435456
open_files_limit=10000
innodb_buffer_pool_size = 128M
innodb_log_file_size = 128M
key_buffer_size = 64M
innodb_file_per_table
slow_query_log=1
slow_query_log_file="/var/log/slowqueries"
long_query_time = 3
general_log=1
general_log_file="/var/lib/mysql/generalqueries"


Would really appreciate some suggestions as how to proceed from here to figure out what is consuming my memory and causing the issues.
1GB is "tiny" today.

Swapping is terrible for MySQL performance, so it is important not to tune things too big.

max_allowed_packet -- dangerously high, change to 30M; if you really need more than that, then either get more RAM, or we can dig deeper to find some other solution.

Change max_connections to, say, 40.

Change open_files_limit to, say, 1000.

Can you ferret out the specific error when "establishing a database connection"?  That might help, too.