Title: error establishing a data base connection 2002 code
Last modified: August 22, 2016

---

# error establishing a data base connection 2002 code

 *  [Cary123](https://wordpress.org/support/users/cary123/)
 * (@cary123)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/error-establishing-a-data-base-connection-2002-code/)
 * This is localhost Wamp. Everything was working fine. The only thing that happened
   since it worked was Windows updating. Now my site will not load. I get 2002 error
   code, error establishing a data base connection, your machine denied access. 
   I have checked the config file. It is fine. I have tried to undo the Windows 
   updates to no avail. Really need help.

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

 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/error-establishing-a-data-base-connection-2002-code/#post-5716904)
 * In nutshell, you’re getting this error because WP is unable to establish a database
   connection. Reason why WP is unable to establish a database connection can vary.
   It could be that your database login credentials are wrong or have been changed.
   It could be that your database server is unresponsive. It could be that your 
   database has been corrupted. Majority of the times this error happens because
   of some sort of server error. Also, there could be other factors as well. To 
   troubleshooting this problem:
    – double check your [wp-config.php file settings ](http://codex.wordpress.org/Editing_wp-config.php)
   for the database name, database username and database password, and the host 
   name (e.g., “localhost” Vs. something else). This is where most errors occur.–
   Then make sure wp-config.php is in right location. – Then check that you don’t
   need to change the database host from “localhost” to something else. You can 
   get that info from your hosting provider. – Check the database name matches with
   the database name as is in your wp-config.php file. – Last, but not least, if
   all that information is correct your database probably has a problem with it.–
   There are also many threads on this topic on these forums: [http://wordpress.org/search/Error+establishing+a+database+connection?forums=1](http://wordpress.org/search/Error+establishing+a+database+connection?forums=1)
 *  Thread Starter [Cary123](https://wordpress.org/support/users/cary123/)
 * (@cary123)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/error-establishing-a-data-base-connection-2002-code/#post-5717095)
 * I copied the following log. This may explain what happened and why. I have checked
   my data base. They both seems fine. It seems kind of unlikely that both would
   have gone bad at the same time however, it could be possible. I just don’t know
   enough about this.
 * The only thing that seems consistent is the #2002 error. Everything prior to 
   this was normal.
 * MySQL log
 * 2015-01-27 09:53:28 4688 [Note] InnoDB: The log sequence numbers 11969865 and
   11969865 in ibdata files do not match the log sequence number 11974869 in the
   ib_logfiles!
    2015-01-27 09:53:28 4688 [Note] InnoDB: Database was not shutdown
   normally! 2015-01-27 09:53:28 4688 [Note] InnoDB: Starting crash recovery. 2015-
   01-27 09:53:28 4688 [Note] InnoDB: Reading tablespace information from the .ibd
   files… 2015-01-27 09:53:30 4688 [ERROR] InnoDB: Attempted to open a previously
   opened tablespace. Previous tablespace finishing/wp_commentmeta uses space ID:
   11 at filepath: .\finishing\wp_commentmeta.ibd. Cannot open tablespace slowlane/
   wp_commentmeta which uses space ID: 11 at filepath: .\slowlane\wp_commentmeta.
   ibd InnoDB: Error: could not open single-table tablespace file .\slowlane\wp_commentmeta.
   ibd InnoDB: We do not continue the crash recovery, because the table may become
   InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it. InnoDB:
   To fix the problem and start mysqld: InnoDB: 1) If there is a permission problem
   in the file and mysqld cannot InnoDB: open the file, you should modify the permissions.
   InnoDB: 2) If the table is not needed, or you can restore it from a backup, InnoDB:
   then you can remove the .ibd file, and InnoDB will do a normal InnoDB: crash 
   recovery and ignore that table. InnoDB: 3) If the file system or the disk is 
   broken, and you cannot remove InnoDB: the .ibd file, you can set innodb_force_recovery
   > 0 in my.cnf InnoDB: and force InnoDB to continue crash recovery here.
 *  Thread Starter [Cary123](https://wordpress.org/support/users/cary123/)
 * (@cary123)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/error-establishing-a-data-base-connection-2002-code/#post-5717110)
 * I have narrowed this down. I managed to install a test site on may wampserver.
 * Now when I got to the MyAdmin panel, the test site shows The left column with
   data base and also slows files under structure. The real site shows data base
   at the left, but under structure it says “no tables found in data base”.
 * I have checked and rechecked the config.php file. It hasn’t changed. I have reloaded
   the wampserver and wordpress. Nothing has changed. When I try to load the site
   into the browser I get the install wp page. If I try to reinstall, it says it
   is already there, and it is.
 * At a complete loss. If I dump the whole thing and copy the file the site is in
   back into the www folder will I regain my site?

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

The topic ‘error establishing a data base connection 2002 code’ is closed to new
replies.

## Tags

 * [data-base](https://wordpress.org/support/topic-tag/data-base/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [Cary123](https://wordpress.org/support/users/cary123/)
 * Last activity: [11 years, 4 months ago](https://wordpress.org/support/topic/error-establishing-a-data-base-connection-2002-code/#post-5717110)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
