Setting Woocommerce cause database hangs

mysql
ubuntu
wordpress
website
Category Software and digital electronics / IT
2024-11-05 04:22

I setup wordpress fine. But, when setting up WooCommerce, my database hangs and I see this error message:

Error establishing a database connection

All other websites on the same server hang at the same time.

Using the command top, shows that kswapd0 uses 51% of CPU, and mysql uses 18% of memory and it is active.

Using the command htop shows that the ubuntu SWAP file is full.

What can I do?

Answered by robin
2024-11-20 07:44

Your SWAP partition is full because it is not enough for heavy queries of Woocommerce.

You need to increase your SWAP size. But first, you need to reboot the server so your SWAP gets released:

sudo reboot

then, check the current SWAP:

swapon --show

Let's increase SWAP to 8GB as follows:

sudo swapoff /swapfile
sudo rm  /swapfile
sudo fallocate -l 8G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

Make the change persistent across reboots:

sudo nano /etc/fstab

Add the following line if it’s not already there:

/swapfile none swap sw 0 0
×

Login

No account?
Terms of use
Forgot password?