Issues with SQL Crashing

SYSTEM INFORMATION
OS type and version Ubuntu 20.04
Virtualmin version 6.17-3

Hi everyone,

Just a bit of background. I have around 6 wordpress sites hosted with hostgator shared services, and a bunch of 301 redirects, and I’m using the mail services as well for the 6 WP sites, plus 4 other sub domains for mail only. The shared server keeps getting hacked affecting my sites, I figured, maybe I can run my own VPS with cpanel type of admin panel and was recommended to use virtualmin. I’m a total noob, just started using it today.

All of my sites are quite lightweight, and they actually perform fine on the lowest baby HostGator plan. But, I literally only tried migrating one WP site over to virtualmin and it’s not working out for me. The site basically can’t stay online for more than a few mins, and mysql keeps crashing. I’m hosting on hetzner with the CPX11 server. Would this spec server be enough to host what I need?

When the site crashes, I need to do a sudo service mysql start to get it working again, but it only works for a couple mins before it crashes again.

SQL logs have some errors:

2022-04-12T01:00:23.291334Z 8 [ERROR] [MY-013134] [Server] Table ‘./mydomain/wp_options’ is marked as crashed and should be repaired
2022-04-12T01:00:23.294988Z 8 [Warning] [MY-010756] [Server] Checking table: ‘./mydomain/wp_options’
2022-04-12T01:00:23.613175Z 8 [ERROR] [MY-013134] [Server] Table ‘./mydomain/wp_usermeta’ is marked as crashed and should be repaired
2022-04-12T01:00:23.635012Z 8 [Warning] [MY-010756] [Server] Checking table: ‘./mydomain/wp_usermeta’
2022-04-12T01:00:36.077896Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.28-0ubuntu0.20.04.3) starting as process 101823
2022-04-12T01:00:36.096837Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-04-12T01:00:36.681750Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-04-12T01:00:39.829262Z 0 [System] [MY-010229] [Server] Starting XA crash recovery…
2022-04-12T01:00:40.619660Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.28-0ubuntu0.20.04.3) starting as process 101866
2022-04-12T01:00:40.632143Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-04-12T01:00:41.211932Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-04-12T01:00:44.432086Z 0 [System] [MY-010229] [Server] Starting XA crash recovery…
2022-04-12T01:00:45.323856Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.28-0ubuntu0.20.04.3) starting as process 101909
2022-04-12T01:00:45.336517Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-04-12T01:00:46.431996Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-04-12T01:00:47.178661Z 0 [System] [MY-010229] [Server] Starting XA crash recovery…
2022-04-12T01:00:47.216010Z 0 [System] [MY-010232] [Server] XA crash recovery finished.

It also complains about some tables:

2022-04-12T01:01:07.972977Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2022-04-12T01:01:08.005713Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: ‘127.0.0.1’ port: 33060, socket: /var/run/mysqld/mysqlx.sock
2022-04-12T01:01:08.005753Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: ‘8.0.28-0ubuntu0.20.04.3’ socket: ‘/var/run/mysqld/mysqld.sock’ port: 3306 (Ubuntu).
2022-04-12T01:04:14.553301Z 10 [ERROR] [MY-013134] [Server] Table ‘./mydomain/wp_options’ is marked as crashed and should be repaired
2022-04-12T01:04:14.556930Z 10 [Warning] [MY-010756] [Server] Checking table: ‘./mydomain/wp_options’
2022-04-12T01:07:42.587293Z 19 [ERROR] [MY-013134] [Server] Table ‘./mydomain/wp_wc_admin_note_actions’ is marked as crashed and should be repaired
2022-04-12T01:07:42.591157Z 19 [Warning] [MY-010756] [Server] Checking table: ‘./mydomain/wp_wc_admin_note_actions’
2022-04-12T01:08:46.824272Z 21 [ERROR] [MY-013134] [Server] Table ‘./mydomain/wp_actionscheduler_claims’ is marked as crashed and should be repaired
2022-04-12T01:08:46.827113Z 21 [Warning] [MY-010756] [Server] Checking table: ‘./mydomain/wp_actionscheduler_claims’

sql status when the site fails:

sudo service mysql status
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: signal) since Tue 2022-04-12 01:32:02 UTC; 15ms ago
Process: 106829 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Process: 106867 ExecStart=/usr/sbin/mysqld (code=killed, signal=KILL)
Main PID: 106867 (code=killed, signal=KILL)
Status: “Server startup in progress”

Apr 12 01:32:02 mydomain systemd[1]: mysql.service: Failed with result ‘signal’.
Apr 12 01:32:02 mydomain systemd[1]: Failed to start MySQL Community Server.

The site actually works fine on my existing shared server. Anyone have any idea, maybe something I didn’t set up right?

Thanks!

I believe it is database issue. Please repair it, either using phpmyadmin, wp-cli, mysql CLI, or any tool you are familiar with.
Please refer from here Fixing Corrupt or Broken Files and Databases in WordPress

Ok thanks, I found it strange how it’s not having issues on the existing host and server, all I did was export/import and all of a sudden these issues started.

After investigating, it looks to be crashing due to it being “out of memory”. I only have virtualmin running on this brand new server, with 2gb memory and the 1 WP.

Anyone know if this is normal? Can I optimize virtualmin for better memory usage on the server?

Thanks!

Of course it is not normal to have your database crashing due to lack of memory.

If you’re using clamav, you probably can’t. You don’t have enough memory (ClamAV is about 1GB all by itself).

If you’re using any PHP execution mode other than PHP-FPM you probably shouldn’t be.

If you have mod_php installed, you definitely should not.

Those are some common memory abuse situations.

Thanks. I upgraded the server, and also disabled clamav and enabled PHP Execution mode to PHP-RPM.

Can you explain more about mod_php and how it can be removed? Is this the same as the a2enmod module? Is this not needing for any of the web server hosting services?

You wouldn’t need to remove it unless you installed it. If you installed it, you should not have and should remove it. It is usually installed by the php package (or php<version>-php), which is a metapackage that depends on libapache2-mod-php or whatever.

You should never install mod_php in a modern system. You do not need it, and you do not want it. It is insecure, it is slow, and it is memory-intensive. Daily, I beg people to stop installing it, and yet, people keep installing it.

I see. I basically allowed the installer to pre-install everything - Downloading and Installing Virtualmin – Virtualmin.

I checked the processes running on the server and see php-fpm running. So, I don’t believe this mod_php is enabled. Also, I dug further, I’m now hosting 4 WP sites and only had one of them changed to FPM a couple days back, so I changed the other 4 from PHP CGI to PHP FPM and that alone was a game changer. This reduced dozens of processes that were running before. Before these changes, my server was hovering at 70% memory utilization, now it’s down to 20%, awesome.

Thanks for the help/suggestions, I’m loving this virtualmin software. Just got to figure out the email stuff now.

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.