Title: Database Error when Publishing Posts
Last modified: August 18, 2016

---

# Database Error when Publishing Posts

 *  [mcrebbe](https://wordpress.org/support/users/mcrebbe/)
 * (@mcrebbe)
 * [20 years ago](https://wordpress.org/support/topic/database-error-when-publishing-posts/)
 * Following a mildly traumatic move to a new server, I now have my sites back up
   and running.
 * When I post to [http://www.thetechnofile.com](http://www.thetechnofile.com) the
   post appears as per normal in the blog, but part way through publishing, I get
   the following error message:
 * WordPress database error: [Lost connection to MySQL server during query]
    INSERT
   INTO wp_postmeta (post_id,meta_key,meta_value) VALUES (‘159′,’_pingme’,’1′)
 * Warning: Cannot modify header information – headers already sent by (output started
   at /home/myaccount/public_html/thetechnofile/wp-includes/wp-db.php:102) in /home/
   myaccount/public_html/thetechnofile/wp-admin/post.php on line 127
 * The same thing happens when editing an existing post.
 * I’m running WP 2.0.2
 * Help please.
 * Cheers,
 * MC

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

 *  [Samuel B](https://wordpress.org/support/users/samboll/)
 * (@samboll)
 * [20 years ago](https://wordpress.org/support/topic/database-error-when-publishing-posts/#post-383362)
 * Try putting:
 * headers already sent
 * in the search box. You might be amazed.
 *  Thread Starter [mcrebbe](https://wordpress.org/support/users/mcrebbe/)
 * (@mcrebbe)
 * [20 years ago](https://wordpress.org/support/topic/database-error-when-publishing-posts/#post-383386)
 * I was not.
 * Perhaps someone has something constructive to add?
 *  [Mark (podz)](https://wordpress.org/support/users/podz/)
 * (@podz)
 * [20 years ago](https://wordpress.org/support/topic/database-error-when-publishing-posts/#post-383387)
 * “Lost connection to MySQL server during query”
    is a hosting issue. For some 
   reason the comunication between your side of things and the database is going
   wrong. I’d have a chat to your support – WP would not do this.
 *  Thread Starter [mcrebbe](https://wordpress.org/support/users/mcrebbe/)
 * (@mcrebbe)
 * [20 years ago](https://wordpress.org/support/topic/database-error-when-publishing-posts/#post-383395)
 * Thank for that Podz. I’ll get onto them
 * MC
 *  Thread Starter [mcrebbe](https://wordpress.org/support/users/mcrebbe/)
 * (@mcrebbe)
 * [20 years ago](https://wordpress.org/support/topic/database-error-when-publishing-posts/#post-383481)
 * OK, so I’ve spoken to my hosts and tried various things:
 * I did a clean installation of WP 2.0.2 (using Fantastico) in a sub domian and
   editing/publishing posts worked perfectly…until I imported my existing database,
   after which I got exactly the same error again. We tried repairing the database
   and still get the same problem.
 * My hosts suggest this means it is neither WordPress nor a hosting issue, but 
   a database issue.
 * HOWEVER, when I remove my largeish list of pings (or just try with a couple of
   pings) the problem disapears. Which makes me think that what is happening is 
   that WordPress is timing out whilst trying to ping my long list?
 * The only possibly illogical thing about that thought, is that with the clean 
   fantastico install (before the databse was restored), WordPress would hapilly
   ping everything on the long list.
 * Searching the Fora, I did find this plug-in [http://somethingunpredictable.com/wp-no-ping-wait/](http://somethingunpredictable.com/wp-no-ping-wait/)
   
   Which seems to solve the problem (which would appear to support the idea that
   WP is timing out).
 * However, I’m not convinced that any pinging is actually happening with that plug
   in activated, as pings don’t seem to show up on Technorati or elswehere, so I’m
   wondering if all it is actually doing with WP 2.0.2 is to switch off the pings,
   which is how it is solving the problem?
 * My hosting company have suggested batting it back to the WP fora, so does anyone
   have any comments/suggestions?
 * BTW it is not, as far as I can tell, a whitespace issue. I have doublechecked
   and reuploaded both files mentioned in the error message as well as the wp_config.
   php and it makes absolutely no difference whatsoever. I still get the same error
   messages.
 * It has been suggested the database may be corrupted in some way. If that’s the
   case it means doing a clean install and manually copying everything across, which
   I’d rather avoid.
 * On the other hand, if the DB has been compromised, I don’t want to use a quick
   fix like the plug in above or reducing my ping list, only to find somewhere down
   the line that I have to recreate the databse manually…by which time I may have
   added a couple of hundred more posts.
 * Help please!
 * Cheers,
 * MC
 *  Thread Starter [mcrebbe](https://wordpress.org/support/users/mcrebbe/)
 * (@mcrebbe)
 * [20 years ago](https://wordpress.org/support/topic/database-error-when-publishing-posts/#post-383524)
 * Update:
 * I have dramatically reduced the size of my pings list on [http://www.mcrebbe.com](http://www.mcrebbe.com)
   by replacing it with list #2 suggested here:
 * [http://www.instant-info-online.com/wordpress-compressed-all-inclusive-ping-list.html](http://www.instant-info-online.com/wordpress-compressed-all-inclusive-ping-list.html)
 * I am still having the same problem regardless.
 * Help!
 *  [Samuel B](https://wordpress.org/support/users/samboll/)
 * (@samboll)
 * [20 years ago](https://wordpress.org/support/topic/database-error-when-publishing-posts/#post-383525)
 * [http://wordpress.org/support/topic/54451?replies=4](http://wordpress.org/support/topic/54451?replies=4)
 * Still sounds like a whitespace issue. Sorry if you don’t think that’s constructive.
 *  Thread Starter [mcrebbe](https://wordpress.org/support/users/mcrebbe/)
 * (@mcrebbe)
 * [20 years ago](https://wordpress.org/support/topic/database-error-when-publishing-posts/#post-383526)
 * Sorry Samboll. I misunderstood your original response. My bad. You were being
   constructive.
 * However, I did check for whitespace in the files mentioned in the erro message
   + wp_config.php and the problem still persists.
 * I also did a clean install, which worked perfectly until I imported my original
   database into it, at which point the problem replicated.
 * ???
 * MC
 *  [Samuel B](https://wordpress.org/support/users/samboll/)
 * (@samboll)
 * [20 years ago](https://wordpress.org/support/topic/database-error-when-publishing-posts/#post-383527)
 * Maybe you should post the code for both files at
    [http://paste.uni.cc](http://paste.uni.cc)
   and some of us can have a look. Maybe you’re too close to problem and frustrated?:
   >) Be sure and x out pertinent info in config file (username, password, etc.).
 *  [Mark (podz)](https://wordpress.org/support/users/podz/)
 * (@podz)
 * [20 years ago](https://wordpress.org/support/topic/database-error-when-publishing-posts/#post-383528)
 * MCRebbe – try:
    – removing all pinging for a day or so – deactivate plugins. 
   If you can deactivate them all and this does continue at least we know it’s nothing
   to do with them. If it does not continue then we have a guilty plugin.
 * I think it’s the pinging.
    I think the blog is waiting so long for a reply that
   somewhere a process finishes – and throws that error at you.
 * [“Warning: Cannot modify header information – headers already sent by (output
   started at /home/myaccount/public_html/thetechnofile/wp-includes/wp-db.php:102)”
   
   such errors between internal files are usually caused by code in those files.
   Quite why they throw a ‘headers already sent’ is beyond me as core files very
   very rarely have a whitespace problem]
 *  Thread Starter [mcrebbe](https://wordpress.org/support/users/mcrebbe/)
 * (@mcrebbe)
 * [20 years ago](https://wordpress.org/support/topic/database-error-when-publishing-posts/#post-383529)
 * Thanks Podz.
 * I already tried all of the above a couple of days ago:
 * – The problem happens regardless of whether or not plug ins are activated.
 * -The problem only happens when pinging. If pings are removed from the options/
   writing tab, the problem does not happen, with or without plug ins activated/
   deactivated.
 * – Nevertheless I have tried this all again, with exactly the same results.
 * – The exception is the ‘No Ping Wait’ plug in, which I started experimenting 
   with a couple of days ago. When it is activated, the problem disapears.
 * BTW: None of this was a problem on the old server, though thinking about it, 
   I was running versions 1.5.2 (mcrebbe) & 2.0 (thetechnofile) on that server. 
   I did upgrade both blogs to 2.0.2 on the old server (and everything seemed fine)
   before moving to the new one, but I didn’t actually post anything on the old 
   server after that upgrade.
 * – I thought it was the pinging too. However, I did a clean install of WP 2.0.2
   on the new server (using fantastico), added the original very long list of pings
   to the options page, did a test posting and everything worked perfectly…then 
   I imported my wordpress database and the problem appeared again?
 *  [pauljohns](https://wordpress.org/support/users/pauljohns/)
 * (@pauljohns)
 * [20 years ago](https://wordpress.org/support/topic/database-error-when-publishing-posts/#post-383557)
 * Try what is suggested in this thread –
    [http://wordpress.org/support/topic/47354](http://wordpress.org/support/topic/47354)
 * It solved my issue. It’s whitespace in the wp-blog-header.php file… maybe.
 *  [stchatterbox](https://wordpress.org/support/users/stchatterbox/)
 * (@stchatterbox)
 * [20 years ago](https://wordpress.org/support/topic/database-error-when-publishing-posts/#post-383560)
 * The same problem happens after I upgraded to WP 2.0.2. I was about to post my
   problem here and now founded this long thread. Perhaps I’ll try Paul Johns’ solution
   by cleaning those white spaces.
 *  Thread Starter [mcrebbe](https://wordpress.org/support/users/mcrebbe/)
 * (@mcrebbe)
 * [20 years ago](https://wordpress.org/support/topic/database-error-when-publishing-posts/#post-383605)
 * Paul,
 * Thanks, but I tried what was in that thread ages ago – it solved nothing. As 
   I & others have already said above, it’s not a whitespace issue.
 *  [pauljohns](https://wordpress.org/support/users/pauljohns/)
 * (@pauljohns)
 * [19 years, 12 months ago](https://wordpress.org/support/topic/database-error-when-publishing-posts/#post-383624)
 * Darn, sorry to hear that. 🙁
    If I find anything useful, I’ll post again.

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

The topic ‘Database Error when Publishing Posts’ is closed to new replies.

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [publishing](https://wordpress.org/support/topic-tag/publishing/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 15 replies
 * 5 participants
 * Last reply from: [pauljohns](https://wordpress.org/support/users/pauljohns/)
 * Last activity: [19 years, 12 months ago](https://wordpress.org/support/topic/database-error-when-publishing-posts/#post-383624)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
