• 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 6 years, 10 months ago by kkarpuk.
Viewing 1 replies (of 1 total)
  • 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.