Title: WordPress database error: [No Database Selected]
Last modified: August 18, 2016

---

# WordPress database error: [No Database Selected]

 *  [espek](https://wordpress.org/support/users/espek/)
 * (@espek)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/wordpress-database-error-no-database-selected/)
 * Not sure why I’m getting this error.
 * WP is installed and content is loaded just fine. But for reasons that I have 
   yet to understand (or trackdown) I get this error on certain parts of the code
   at certain unpredictible times:
 * `WordPress database error: [No Database Selected]` with more specific DB table
   stuff below specific to where it was making the DB call.
 * This seems to happen on secondary type links like where it’s supposed to populate
   the “Category” or the “Next Post”, “Previous Post” Links. Yet, I can see the 
   content of the “post” just fine. So getting that part from the DB seems to be
   fine, but for other things it looses the connection somehow.
 * If I reload the page a couple of times, it seems to go away. A single page reload
   won’t do it. But then it will happen on another page.
 * Any help would be appreciated since work is for a client who was all excited 
   about having part of the site run on WordPress, but now I don’t want to scare
   him into thinking that he will have similar problems.
 * I have WP 1.5 right now, and never saw this before in 1.2.

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

 *  Thread Starter [espek](https://wordpress.org/support/users/espek/)
 * (@espek)
 * [21 years, 3 months ago](https://wordpress.org/support/topic/wordpress-database-error-no-database-selected/#post-163379)
 * Call off the hounds. Found the problem and it had nothing to do with WP code.
 * Thanks anyway folks.
 *  [linthuman](https://wordpress.org/support/users/linthuman/)
 * (@linthuman)
 * [21 years ago](https://wordpress.org/support/topic/wordpress-database-error-no-database-selected/#post-163877)
 * I’d be interested in knowing what you did. I have this problem, too: an intermittent,
   yet persistent error when making subsidiary calls to the database for category
   lists, etc. I created some screen shots, if anyone is interested enough in taking
   a look to see if they can help:
    - [home page](http://www.humanlint.com/i/wp-db-error-home.gif)
    - [individual entry page](http://www.humanlint.com/i/wp-db-error-post.gif)
    - [archives page](http://www.humanlint.com/i/wp-db-error-archive.gif)
 * Any help gratefully appreciated. Thanks.
 *  [linthuman](https://wordpress.org/support/users/linthuman/)
 * (@linthuman)
 * [21 years ago](https://wordpress.org/support/topic/wordpress-database-error-no-database-selected/#post-163878)
 * Sorry, ought to explain: using WordPress 1.5.1.1. [Home page](http://www.humanlint.com/),
   though see screen shots posted above if the problem not in evidence. Error message
   takes the form:
 * WordPress database error: [No database selected]
    SELECT cat_ID, cat_name, category_nicename,
   category_description, category_parent FROM wp_categories WHERE cat_ID > 0 ORDER
   BY cat_ID asc
 * Could this be a problem with my WordPress installation, or the database itself?
   I’ve tried disabling plugins, but the problem remains.
 *  [linthuman](https://wordpress.org/support/users/linthuman/)
 * (@linthuman)
 * [21 years ago](https://wordpress.org/support/topic/wordpress-database-error-no-database-selected/#post-163879)
 * No ideas? Is a database backup and WordPress reinstall necessary?
 *  [escape](https://wordpress.org/support/users/escape/)
 * (@escape)
 * [21 years ago](https://wordpress.org/support/topic/wordpress-database-error-no-database-selected/#post-163882)
 * I had the same problem after copying the whole environment from one server to
   another. I found my solution here:
    [http://wordpress.org/support/topic/36462](http://wordpress.org/support/topic/36462)
   Thanks Righton!
 *  [linthuman](https://wordpress.org/support/users/linthuman/)
 * (@linthuman)
 * [21 years ago](https://wordpress.org/support/topic/wordpress-database-error-no-database-selected/#post-163883)
 * That was it! Moving the Shortstat include to the top of the document solved the
   error. Groovy. And after all that confusion!

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

The topic ‘WordPress database error: [No Database Selected]’ is closed to new replies.

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 6 replies
 * 3 participants
 * Last reply from: [linthuman](https://wordpress.org/support/users/linthuman/)
 * Last activity: [21 years ago](https://wordpress.org/support/topic/wordpress-database-error-no-database-selected/#post-163883)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
