Title: MySql Crashes on command truncate table wp_wfhits
Last modified: September 4, 2025

---

# MySql Crashes on command truncate table wp_wfhits

 *  Resolved [elsandkls](https://wordpress.org/support/users/elsandkls/)
 * (@elsandkls)
 * [7 months, 3 weeks ago](https://wordpress.org/support/topic/mysql-crashes-on-command-truncate-table-wp_wfhits/)
 * 
   Should I recreate the database, and tables? Any suggestions on what else I can
   do to fix this?There’s more logs as part of the mysql crash but these are some
   for wordfence. Is there a bug in mysql where if you use the truncate command 
   it crashes mysql?I can’t find a bug report on mysql about it, so I suspect it’s
   just me and my database.It’s consistent crashing every time a truncate command
   is on the wfhits. I ran all the checks on the tables, no errors or warnings, 
   and checked the config for file size or memory mismatches thinking I had things
   set to small, but they look ok, The tables weren’t even that large really. It’s
   a small wordpress site, I only noticed it because I was working on the site, 
   and mysql kept crashing. Manually running the truncate command on the tables 
   in mysql command line cause the same issue. I have 8 sites on that server, and
   it’s the wfhits table that get’s truncated AND crashes mysql most often. Any 
   suggestions? $ sudo cat /var/log/mysql/error.log | grep QueryQuery (7f8b8c77c460):
   TRUNCATE TABLE wp_wc_category_lookup2025-09-03T10:35:18.911093Z 0 [System] [MY-
   013951] [Server] Query (7f8b8c77c460): TRUNCATE TABLE wp_wc_category_lookupQuery(
   7f7fc0015620): TRUNCATE TABLE wp_wc_category_lookup2025-09-03T15:05:10.438830Z
   0 [System] [MY-013951] [Server] Query (7f7fc0015620): TRUNCATE TABLE wp_wc_category_lookup
   $ sudo cat /var/log/mysql/error.log.1 | grep QueryQuery (7fc8654f7890): truncate
   table wp_wfhits2025-09-02T05:45:01.021991Z 0 [System] [MY-013951] [Server] Query(
   7fc8654f7890): truncate table wp_wfhitsQuery (7f422869eae0): truncate table wp_wfhits2025-
   09-02T08:33:43.348744Z 0 [System] [MY-013951] [Server] Query (7f422869eae0): 
   truncate table wp_wfhitsQuery (7f60148609e0): TRUNCATE TABLE wp_wc_category_lookup2025-
   09-02T10:36:29.136741Z 0 [System] [MY-013951] [Server] Query (7f60148609e0): 
   TRUNCATE TABLE wp_wc_category_lookupQuery (7f6dc0a508b0): truncate table wp_wfhits2025-
   09-02T12:19:49.888865Z 0 [System] [MY-013951] [Server] Query (7f6dc0a508b0): 
   truncate table wp_wfhitsQuery (7fc294b61bb0): truncate table wp_wfhitsQuery (
   7f2c0c2faab0): TRUNCATE TABLE wp_wc_category_lookupQuery (7f3068c32260): truncate
   table wp_wfhitsQuery (7efffde8b6e0): truncate table wp_wfhitsQuery (7ff6182cd700):
   TRUNCATE TABLE wp_wc_category_lookupQuery (7fc6e413d570): truncate table wp_wfhooverQuery(
   7fc6f41664d0): TRUNCATE TABLE wp_wc_category_lookupQuery (7fef80ebb7a0): truncate
   table wp_wfhoover 69805-Trying to get some variables.69835-Some pointers may 
   be invalid and cause the dump to abort.69893:Query (7fef80ebb7a0): truncate table
   wp_wfhoover69942-Connection ID (thread ID): 870069974-Status: NOT_KILLED52771-
   Trying to get some variables.52801-Some pointers may be invalid and cause the
   dump to abort.52859:Query (7efffde8b6e0): truncate table wp_wfhits52906-Connection
   ID (thread ID): 12352937-Status: NOT_KILLED mysql> SHOW TABLE STATUS WHERE Name
   =’wp_wfhits’; Name | Engine | Version | Row_format | Rows | Avg_row_length | 
   Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time
   | Update_time | Check_time | Collation | Checksum | Create_options | Comment 
   | +———–+——–+———+———— | wp_wfhits | InnoDB | 10 | Dynamic | 192114 | 360 | 69304320
   | 0 | 21577728 | 6291456 | 420331 | 2024-03-15 18:44:08 | NULL | NULL | utf8mb3_general_ci
   | NULL | | | 1 row in set (0.01 sec) mysql> CHECK TABLE wp_wfhits; +—————————–
   +——-+———-+———-+ | Table | Op | Msg_type | Msg_text | +—————————–+——-+———-+———-
   + | wp_wfhits | check | status | OK | 1 row in set (11.87 sec) mysql> SELECT 
   VERSION(); +————————-+ | VERSION() | +————————-+ | 8.0.43-0ubuntu0.22.04.1 | 
   +————————-+ 1 row in set (0.00 sec) | innodb_fast_shutdown | 1 | | innodb_file_per_table
   | ON | | innodb_log_buffer_size | 16777216 | | innodb_log_checksums | ON | | 
   innodb_log_compressed_pages | ON | | innodb_log_file_size | 50331648 | | innodb_log_files_in_group
   | 2 | | innodb_log_group_home_dir | ./ | | innodb_log_spin_cpu_abs_lwm | 80 |
   | innodb_log_spin_cpu_pct_hwm | 50 | | innodb_log_wait_for_flush_spin_hwm | 400
   | | innodb_log_write_ahead_size | 8192 | | innodb_log_writer_threads | ON | innodb_buffer_pool_chunk_size
   | 134217728 | | innodb_buffer_pool_dump_at_shutdown | ON | | innodb_buffer_pool_dump_now
   | OFF | | innodb_buffer_pool_dump_pct | 25 | | innodb_buffer_pool_filename | 
   ib_buffer_pool | | innodb_buffer_pool_in_core_file | ON | | innodb_buffer_pool_instances
   | 1 | | innodb_buffer_pool_load_abort | OFF | | innodb_buffer_pool_load_at_startup
   | ON | | innodb_buffer_pool_load_now | OFF | | innodb_buffer_pool_size | 134217728
   | | innodb_change_buffer_max_size | 25 | | innodb_change_buffering | all |

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [awyork](https://wordpress.org/support/users/awyork/)
 * (@awyork)
 * [7 months, 3 weeks ago](https://wordpress.org/support/topic/mysql-crashes-on-command-truncate-table-wp_wfhits/#post-18626920)
 * Truncate is a DDL command vs a DML command. Those commands take elevated privileges.
   Does the user account have the right permissions?
   Some databases have a safe 
   delete mode and require another step to get mass delete commands to work. This
   can be turned on/off. (This shouldn’t be a problem with truncate though.)It’s
   possible you truncate command will cause a foreign key constraint violation. (
   This might be the problem you’re seeing.)
 *  Plugin Support [wfpeter](https://wordpress.org/support/users/wfpeter/)
 * (@wfpeter)
 * [7 months, 3 weeks ago](https://wordpress.org/support/topic/mysql-crashes-on-command-truncate-table-wp_wfhits/#post-18628096)
 * Hi [@elsandkls](https://wordpress.org/support/users/elsandkls/), thanks for your
   detailed post.
 * As the `TRUNCATE` command also fails when manually running it outside of WordPress
   I would certainly check permissions as awyork mentions, and also whether the 
   table needs to be repaired. If it’s neither of those, I would check in with your
   host to explain what you’re trying to do in case there’s a known limitation or
   problem with the database itself that could be diagnosed at that time.
 * Let us know what you find out,
   Peter.
 *  Thread Starter [elsandkls](https://wordpress.org/support/users/elsandkls/)
 * (@elsandkls)
 * [7 months, 3 weeks ago](https://wordpress.org/support/topic/mysql-crashes-on-command-truncate-table-wp_wfhits/#post-18631913)
 * Based on your suggestion, To test the privileges I gave that account all privileges.
   It’s still crashing MySQL when I run truncate both manually and through WordPress.
   It’s a dedicated box, running Ubuntu. I believe the issue was occurring a few
   months ago but I hadn’t noticed. I upgraded to the most recent version of MySQL
   and PHP about two or three months ago to fix some other issues. I checked all
   of the tables in that database to see if they need to be repaired. I only posted
   the results of wfhits above but I actually checked all the tables. It’s a dedicated
   box, the host provides the IP and the hardware. I’m responsible for the software
   and os. Anything else I can check. If not I’ll start rebuilding it. I have 8 
   sites on that server all running WordPress, and this is the only one that seems
   to be having this issue. The others are running smooth. They are even smaller
   sites though, so if it’s related to file size of the database at all, they are
   much smaller.
 *  Thread Starter [elsandkls](https://wordpress.org/support/users/elsandkls/)
 * (@elsandkls)
 * [7 months, 3 weeks ago](https://wordpress.org/support/topic/mysql-crashes-on-command-truncate-table-wp_wfhits/#post-18631919)
 * Also “truncate command will cause a foreign key constraint violation” I checked
   there aren’t any on any of the tables the truncate command is being run on .
 *  Plugin Support [wfpeter](https://wordpress.org/support/users/wfpeter/)
 * (@wfpeter)
 * [7 months, 3 weeks ago](https://wordpress.org/support/topic/mysql-crashes-on-command-truncate-table-wp_wfhits/#post-18633462)
 * Hi [@elsandkls](https://wordpress.org/support/users/elsandkls/),
 * It does sound like it could be a potential setup issue as it’s happening on the
   database regardless of WordPress being involved. We can ultimately only support
   Wordfence here, but the issue you’ve mentioned could be from quite a broad range
   of areas like permissions, the MySQL configuration, table collation for WordPress,
   etc.
 * We’d be happy to at least take a look at your site diagnostics to see if we can
   point you in the right direction. You can send one to **wftest @ wordfence . 
   com** by using the link at the top of the **Wordfence > Tools > Diagnostics**
   page, followed by **“Send Report by Email”**. Please** add your forum username**
   where indicated **and _respond to us here after you have sent it._**
 * **NOTE:** It should look as follows – Screenshot of [Tools > Diagnostic > Send by Email](https://www.wordfence.com/wp-content/uploads/2021/09/diagnosticsendbyemail.png)
 * Thanks again,
   Peter.
 *  Plugin Support [wfpeter](https://wordpress.org/support/users/wfpeter/)
 * (@wfpeter)
 * [7 months, 2 weeks ago](https://wordpress.org/support/topic/mysql-crashes-on-command-truncate-table-wp_wfhits/#post-18643956)
 * Hi [@elsandkls](https://wordpress.org/support/users/elsandkls/),
 * I haven’t been able to find a diagnostic with your username attached. Do you 
   still require assistance with this?
 * Many thanks,
   Peter.
 *  Thread Starter [elsandkls](https://wordpress.org/support/users/elsandkls/)
 * (@elsandkls)
 * [7 months, 2 weeks ago](https://wordpress.org/support/topic/mysql-crashes-on-command-truncate-table-wp_wfhits/#post-18644072)
 * I’ve decided to rebuild the database and site and see if I can fix it myself.
   Thank you for the offer. I was just checking to see if anyone had suggestions
   that might clue me into what I’ve missed. I have several other sites on that 
   server, that run fine until mysql crashes because of this site. I’ll sort it.
   Thank you!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘MySql Crashes on command truncate table wp_wfhits’ is closed to new replies.

 * ![](https://ps.w.org/wordfence/assets/icon.svg?rev=2070865)
 * [Wordfence Security - Firewall, Malware Scan, and Login Security](https://wordpress.org/plugins/wordfence/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordfence/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordfence/)
 * [Active Topics](https://wordpress.org/support/plugin/wordfence/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordfence/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordfence/reviews/)

## Tags

 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)
 * [truncate](https://wordpress.org/support/topic-tag/truncate/)

 * 7 replies
 * 3 participants
 * Last reply from: [elsandkls](https://wordpress.org/support/users/elsandkls/)
 * Last activity: [7 months, 2 weeks ago](https://wordpress.org/support/topic/mysql-crashes-on-command-truncate-table-wp_wfhits/#post-18644072)
 * Status: resolved