Title: Problems establishing imported database connection in localhost
Last modified: April 18, 2018

---

# Problems establishing imported database connection in localhost

 *  [kkarpuk](https://wordpress.org/support/users/kkarpuk/)
 * (@kkarpuk)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/problems-installing-wordpress-in-localhost/)
 * My issue: Good old “Error establishing connection” when connecting to my wordpress
   site through my localhost while connecting to a newly imported database.
 * What I did:
 * I exported a copy of my database from my old computers localhost.
    I downloaded
   InstantWP and installed a default WordPress setup I created a new database called“
   kalevkuus” through mySqladmin. I imported the database to kalevkuus through mysqladmin
   I changed wp-config to change the database name from default(“wordpress”) to 
   new one “kalevkuus”. The username and passwords are correct – quadruple checked
   When connecting I get the “Error establishing connection” If I change the DB 
   name to default “wordpress” ( which is also listed in my mysqladmi ) it connects
   and shows the page.
 * What I’ve tried
 * Added the define(‘WP_ALLOW_REPAIR’, true); and ran the repair. Outcome is The
   wp_users table is okay. Failed to optimize the wp_users table. Error: Table does
   not support optimize, doing recreate + analyze instead Same for (wp_) user,usermeta,
   posts,comments,links, options, postmeta,terms, term_taxonomy, term_relationship,
   term_meta, commentmeta.
    Created the php connection test file.
 * $conn = new mysqli($servername, $username, $password);
 * // Check connection if ($conn->connect_error) { die(“Connection failed: ” . $
   conn->connect_error); } echo “Connected successfully”; ?>
 * Outcome is “Connection successful”.
 * So my guess is that something is wrong with the tables in my database but I have
   no idea how to confirm it.
 * Can someone help me to fix this issue?
    -  This topic was modified 7 years, 11 months ago by [kkarpuk](https://wordpress.org/support/users/kkarpuk/).

Viewing 1 replies (of 1 total)

 *  [RossMitchell](https://wordpress.org/support/users/rossmitchell/)
 * (@rossmitchell)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/problems-installing-wordpress-in-localhost/#post-10194253)
 * Are you really sure that the database user and password are correct ?
    Does this
   user have permissions on the database ALL permissions ? Is there anything interesting
   in the error logs of your Apache and mySQL servers ?

Viewing 1 replies (of 1 total)

The topic ‘Problems establishing imported database connection in localhost’ is closed
to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [RossMitchell](https://wordpress.org/support/users/rossmitchell/)
 * Last activity: [7 years, 11 months ago](https://wordpress.org/support/topic/problems-installing-wordpress-in-localhost/#post-10194253)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
