Question

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

Posted October 22, 2018 1.3k views
WordPressUbuntu 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?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
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
Submit an Answer