WordPress going offline for some minutes in some database-intensive activities

October 22, 2018 439 views
WordPress Ubuntu 18.04

Hi,

I am using a WordPress droplet for this website: Trovalost.it

but when I try to do some MySQL-intensive activities (i.e editing more than a post, or fixing links in web pages) sometimes MySQL goes offline. I looked in /var/log/mysql/error.log but it looks empty, so no idea about what problem I need to solve.

Looked inside /etc/mysql/mysql.conf.d/mysqld.cnf
and it is ok for log ON.

/var/log/mysql/mysql-slow.log is empty too.

Any hint for this?

2 Answers

What do you mean by MySQL goes offline? What error do you get on the page? Is it a "freeze" of pages or an actual DB error connection?

If the DB is actually shutdown, you should be able to see a shutdown/startup in the error log. Otherwise I'd suspect your DB engine is MyISAM, which does table level locks (vs row-level locks) on the whole table and makes editing posts simultaneously not possible.

Run these commands to get a feel of things:

mysql -u root -e "show table status" unixy_whmcs1|grep -i myisam

If you get many MyISAM tables, it's probably time to switch to InnoDB.

Cheers

  • Hi and thanks for answer.

    Yes, I mean a DB connection error I.e error establishing a database connection - it disappears if I try to restart mysql manually.

    Almost all tables are MyISAM as I see, so I suppose should switch in InnoDB.

    Thanks very much!

Yes I'd definitely switch to InnoDB. This issue would go away. Here's a quick one liner:

mysql -u root -e "show tables" <my_db> | while read tbl; do echo mysql -u root -e "alter table ${tbl} engine=InnoDB" <my_db>; done
Have another answer? Share your knowledge.