Support » Fixing WordPress » Error establishing a database connection

Viewing 15 replies - 1 through 15 (of 18 total)
  • Hi,

    Please check the below-defined value set properly in the wp-config.php file.

    define(‘DB_NAME’, ‘database-name’); – Your database name
    define(‘DB_USER’, ‘database-username’); – Your database User name
    define(‘DB_PASSWORD’, ‘database-password’); – Your database password
    define(‘DB_HOST’, ‘localhost’); – host name

    Thanks

    Moderator Steve Stern (sterndata)

    (@sterndata)

    Forum Moderator & Support Team Volunteer

    Also, check with your host to make sure the database service is up and running

    Thread Starter gary4u

    (@gary4u)

    Hi,

    Thank you for your response. first I have checked with the server guys and they have said all is fine at their end. So I checked the wp-config.php this also looks to be fine.

    Have checked these :
    define(‘DB_NAME’, ‘database-name’); – Your database name – CORRECT
    define(‘DB_USER’, ‘database-username’); – Your database User name – CORRECT
    define(‘DB_PASSWORD’, ‘database-password’); – Your database password – CORRECT
    define(‘DB_HOST’, ‘localhost’); – host name – CORRECT

    The username looks alright , so I have tried to change the database password in the Database – change password. This also has been no use , it shows Error.[ lOOKS LIKE I CANNOT CHANGE THE DATABASE PASSWORD]

    I have also removed all history and cookies etc but no use.

    Even I have entered this – define(‘WP_ALLOW_REPAIR’, true); in the wp-config.php this also does work.

    Even the main site does not open have tried also opening other files from the website but this is also does not work.

    Please help me on this.

    Thanks
    Gary

    Moderator Steve Stern (sterndata)

    (@sterndata)

    Forum Moderator & Support Team Volunteer

    Can you access the database via PHPMYADMIN from your hosting control panel?

    Thread Starter gary4u

    (@gary4u)

    Yes I can access the database via PHPMYADMIN from your hosting control panel.

    Moderator Steve Stern (sterndata)

    (@sterndata)

    Forum Moderator & Support Team Volunteer

    OK, good.

    So, one of the constants in wp-config.php is wrong. I am assuming that the site did work and stopped, so what else happened just before it stopped working?

    Thread Starter gary4u

    (@gary4u)

    Honestly no idea. But I started getting this messages before that “your IPS address is attacked” , I have taken a screen shot , I contacted the Server company about this and they have said that they have no issues , and then I contacted the Antivirus company[ Kaspersky ] they to have said all is fine and told me to have a good day. Now I am stuck with this. Best part is that this happens[Error establishing a database connection] only when I try opening these sites which I mentioned earlier.

    But what I am not able to understand why I cannot change the Database password in – PHPMYADMIN

    I dont know what else to try.

    Gary

    Your hosting company should be able to help you reset your database password. Usually you can do this yourself via cPanel or whatever panel they use. I don’t think you can do it via phpmyadmin.

    Thread Starter gary4u

    (@gary4u)

    Hi,

    Thank you for your response. Yes sorry one cannot change the password in phpmyadmin. It can be done in Cpanel. But is showing Error when I do. I can change my other databases passwords but not this one . Not sure why , I have checked with my server guys they said that there is nothing wrong at they end and I should check at my side.

    I am using Astra theme for this project. It is a eCommerce , woo-commerce and with instamojo. Can it be any of the plugins that can be causing the problem not sure. To check I first need to login to the dashboard which I am unable to.

    Like I said I did try to change the password in the Cpanel Database but it is showing Error. Do I need to uninstall the complete WP and reinstall.?

    The site was working fine and all of a sudden it just got cut off with -” Error establishing a database connection “. Not able to see the main site and the login page itself.

    Please let me know.

    Thanks

    Gary

    Moderator Steve Stern (sterndata)

    (@sterndata)

    Forum Moderator & Support Team Volunteer

    You *can* change the password for your DB_USER in phpmyadmin

    https://synoguide.com/2014/02/20/change-password-sql-database-phpmyadmin/

    This may be a plugin or theme conflict. Please attempt to disable all plugins, and use one of the default (Twenty*) themes. If the problem goes away, enable them one by one to identify the source of your troubles.

    If you can install plugins, install “Health Check”: https://wordpress.org/plugins/health-check/ On the troubleshooting tab, you can click the button to disable all plugins and change the theme for you, while you’re still logged in, without affecting normal visitors to your site. You can then use its admin bar menu to turn on/off plugins and themes one at a time.

    See http://www.wpbeginner.com/plugins/how-to-deactivate-all-plugins-when-not-able-to-access-wp-admin/

    Thread Starter gary4u

    (@gary4u)

    Set MySQL User Password
    The request failed. (Error ID kak69e)

    This the message I am getting when I try to change the password. What should I do now.

    Gary

    Moderator Steve Stern (sterndata)

    (@sterndata)

    Forum Moderator & Support Team Volunteer

    At this point, I think you really need to get your host involved.

    Thread Starter gary4u

    (@gary4u)

    This is the reply I got from the Server guys.

    [Hi,
    You can simply delete the mysql user and recreate / Else delete and recreate with alternate name on your cPanel and update the same on your configuration file .
    And this will resolve your issue.
    If Still you facing any issue on specific path, Please do reply us to restore the backup from the last available backup .]

    After this email response form the server guys they have closed the issue.

    So should I go with this or is there any other way to resolve the issue.

    Please let me know.

    Gary

    Moderator Steve Stern (sterndata)

    (@sterndata)

    Forum Moderator & Support Team Volunteer

    I’d try that. create a new DB_USER and update wp-config.php

    Thread Starter gary4u

    (@gary4u)

    Ok will try that.

    Thanks

    Gary

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Error establishing a database connection’ is closed to new replies.