Support » Localhost Installs » Updated PHP, database connection error

  • MVerminski

    (@mverminski)


    Hi,

    I recently updated the PHP version in xampp and now I cannot connect to any local sites. The error establishing database connection message shows up. I didn’t change any user names or passwords.

    I can access phpmyadmin. I tried to click on user accounts and received the attached message which I am guessing is causing the DB connection issue. Any ideas how I can fix this?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • JNashHawkins

    (@jnashhawkins)

    Go into PHPmyAdmin and try to fix the error or else restore your database from your last backup.

    You might need to seek help from someone at someplace like StackExchange or possibly revert back to your earlier version of PHP…

    Sorry, I can’t help you more but this probably isn’t a WordPress issue itself.

    Dion Designs

    (@diondesigns)

    If you can access phpMyAdmin, you have a chance to fix this. Select the mysql database and then click the “structure” icon for the user table. With any luck you will be able to access the table. If you can, click the Indexes link and drop the index, then click the SQL tab at the top and run the following query:

    ALTER TABLE user ADD PRIMARY KEY (Host,User);

    Make sure to enclose “user”, “Host”, and “User” with backticks. (I’d normally do that in a code snippet, but for some dumb unknown reason, bbPress uses backticks for <code> blocks even though it uses HTML tags everywhere else.)

    If you can’t access the user table, then try to repair it. That should work since the issue is an index, but it’s a more dangerous option than the above, so try dropping/re-creating the index first.

    MVerminski

    (@mverminski)

    Thanks for the reply. I followed your steps, but when I run the SQL code it is saying there is a syntax error.

    ALTER TABLE (backtick)user(backtick) ADD PRIMARY KEY ((backtick)Host(backtick),(backtick)User(backtick));

    This isn’t a HUGE issue. I think I only 4 websites locally and they are all live at this point. I can try to start from scratch and pull everything back down locally. I just use these local sites for updating plug-ins, etc. for testing before updating the live sites. May just be easier to do that.

    Dion Designs

    (@diondesigns)

    It’s possible you are using a different version of MySQL and/or phpMyAdmin that isn’t compatible with what I posted.

    In that case, then use phpMyAdmin to create the index. Return to the mysql table structure, open the Indexes section, and use the entry area to create an index on 2 columns. Select the Host and User columns, and PRIMARY as the index choice.

    This assumes you have successfully deleted the old/corrupted index. (Deleting the index should have also restored access to user accounts.) Note that you technically don’t need the index; it’s a safety net to insure you don’t create duplicate 'user'@'host' accounts.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.