Please help: Error establishing a database connection

I have constructed the website
windylee.rf.gd
using Wordpress since one year ago.
Everything went well, but in recent days when I went to the website, it had shown me an error message:
Error establishing a database connection
even I want to access to the wordpress control panel (https://windylee.rf.gd/wp-admin/),
it does not help.

What should I do to fix my website?

Thank you very much for your help.

@wl_402 said:
I have constructed the website
windylee.rf.gd
using Wordpress since one year ago.
Everything went well, but in recent days when I went to the website, it had shown me an error message:
Error establishing a database connection
even I want to access to the wordpress control panel (https://windylee.rf.gd/wp-admin/),
it does not help.

What should I do to fix my website?

Thank you very much for your help.

Hi,
Did you follow what the error said?

Also have you read the KB article already?
https://infinityfree.net/support/common-mysql-errors/

@UnknownLolz said:

@wl_402 said:
I have constructed the website
windylee.rf.gd
using Wordpress since one year ago.
Everything went well, but in recent days when I went to the website, it had shown me an error message:
Error establishing a database connection
even I want to access to the wordpress control panel (https://windylee.rf.gd/wp-admin/),
it does not help.

What should I do to fix my website?

Thank you very much for your help.

Hi,
Did you follow what the error said?

Also have you read the KB article already?
https://infinityfree.net/support/common-mysql-errors/

The error just said “Error establishing a database connection”
and I have no idea what has caused the problem because I did not make changes to my website.
I have tried to alter the ‘wp-config.php’ as somebody did to see if there is any auto repair options. However, I cannot access the auto-repair webpage because doing this showed me “Error establishing a database connection” again.

Is there anything I can try to do to fix the problem?

Thank you for your help.

@wl_402 said:

@UnknownLolz said:

@wl_402 said:
I have constructed the website
windylee.rf.gd
using Wordpress since one year ago.
Everything went well, but in recent days when I went to the website, it had shown me an error message:
Error establishing a database connection
even I want to access to the wordpress control panel (https://windylee.rf.gd/wp-admin/),
it does not help.

What should I do to fix my website?

Thank you very much for your help.

Hi,
Did you follow what the error said?

Also have you read the KB article already?
https://infinityfree.net/support/common-mysql-errors/

The error just said “Error establishing a database connection”
and I have no idea what has caused the problem because I did not make changes to my website.
I have tried to alter the ‘wp-config.php’ as somebody did to see if there is any auto repair options. However, I cannot access the auto-repair webpage because doing this showed me “Error establishing a database connection” again.

Is there anything I can try to do to fix the problem?

Thank you for your help.

Unfortunately, website administration is not as easy as clicking a “Fix It” button. You need to do some actual work yourself.

But there is something you can do. You can read the knowledge base article @UnknownLolz linked to and follow the instructions inside.

@wl_402 said:

@UnknownLolz said:

@wl_402 said:
I have constructed the website
windylee.rf.gd
using Wordpress since one year ago.
Everything went well, but in recent days when I went to the website, it had shown me an error message:
Error establishing a database connection
even I want to access to the wordpress control panel (https://windylee.rf.gd/wp-admin/),
it does not help.

What should I do to fix my website?

Thank you very much for your help.

Hi,
Did you follow what the error said?

Also have you read the KB article already?
https://infinityfree.net/support/common-mysql-errors/

The error just said “Error establishing a database connection”
and I have no idea what has caused the problem because I did not make changes to my website.

FYI it does not only show “Error establish database connection” at my end.
This is what I saw:

Is there anything I can try to do to fix the problem?

Thank you for your help.

Yes there are many ways to solve your problem!

Read the KB article (if you haven’t already):
https://infinityfree.net/support/common-mysql-errors/

That KB article shows you what common errors are produced and how to fix them. If you are still having trouble, just don’t hesitate to ask again in this thread.

Edit:
Sorry, I didn’t notice that Admin already replied here.

Thank you for your help.
Yes, the error message is just ‘Error establishing a database connection’
It seems that the problem is ‘The MySQL Username or Password or Database host is wrong as a connection could not be established.’
But I don’t know what the MySQL username or the password are and I don’t know how to change it. I am using WordPress, but is there a debug mode for WordPress?
How can I fix this problem? Any steps/methods I can try?
Thank you again for all your help.

Edit: I mean, how can I find out the actual MySQL username/password/host ?

cPanel → MySQL Databases?

@wl_402 said:
I am using WordPress, but is there a debug mode for WordPress?

Did you try to punch “wordpress debug mode” in Google already (spoilers: there is a WordPress Codex article explaining it all)? Really, search engines are a blessing for website development.

And what @MrJunior said, of course.

@Admin said:

@wl_402 said:
I am using WordPress, but is there a debug mode for WordPress?

Did you try to punch “wordpress debug mode” in Google already (spoilers: there is a WordPress Codex article explaining it all)? Really, search engines are a blessing for website development.

And what @MrJunior said, of course.

I have searched in google and found an article:

I thought my database has some problem, so I tried to follow the instructions given and went to the repair site:
windylee.rf.gd/wp-admin/maint/repair.php/
but unlike what the writer got, all I get was the ‘error establishing database connection’ again instead of the page that offers repair options.
I have already enabled the repair function.
I don’t think I have change the login credentials recently.
Is there still any methods that I can try?

@wl_402 said:

@Admin said:

@wl_402 said:
I am using WordPress, but is there a debug mode for WordPress?

Did you try to punch “wordpress debug mode” in Google already (spoilers: there is a WordPress Codex article explaining it all)? Really, search engines are a blessing for website development.

And what @MrJunior said, of course.

I have searched in google and found an article:
How to Fix Error Establishing a Database Connection Error
I thought my database has some problem, so I tried to follow the instructions given and went to the repair site:
windylee.rf.gd/wp-admin/maint/repair.php/
but unlike what the writer got, all I get was the ‘error establishing database connection’ again instead of the page that offers repair options.
I have already enabled the repair function.
I don’t think I have change the login credentials recently.
Is there still any methods that I can try?

The first thing you should do is Enable Debug Mode in WordPress. That’s what you need to Google, not the database connection error. With Debug Mode enabled, you can see the actual error message from the database connection generated by the server.

@Admin said:

@wl_402 said:

@Admin said:

@wl_402 said:
I am using WordPress, but is there a debug mode for WordPress?

Did you try to punch “wordpress debug mode” in Google already (spoilers: there is a WordPress Codex article explaining it all)? Really, search engines are a blessing for website development.

And what @MrJunior said, of course.

I have searched in google and found an article:
How to Fix Error Establishing a Database Connection Error
I thought my database has some problem, so I tried to follow the instructions given and went to the repair site:
windylee.rf.gd/wp-admin/maint/repair.php/
but unlike what the writer got, all I get was the ‘error establishing database connection’ again instead of the page that offers repair options.
I have already enabled the repair function.
I don’t think I have change the login credentials recently.
Is there still any methods that I can try?

The first thing you should do is Enable Debug Mode in WordPress. That’s what you need to Google, not the database connection error. With Debug Mode enabled, you can see the actual error message from the database connection generated by the server.

Sorry, I finally understand the problem.

Now I got these errors:

Warning: mysqli_real_connect(): (HY000/1045): Access denied for user ‘20339431_4’@‘192.168.0.52’ (using password: YES) in /home/vol13_5/rf.gd/rfgd_20339431/htdocs/wp-includes/wp-db.php on line 1531

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/vol13_5/rf.gd/rfgd_20339431/htdocs/wp-includes/wp-db.php on line 1562

Warning: mysql_connect(): Access denied for user ‘20339431_4’@‘192.168.0.52’ (using password: YES) in /home/vol13_5/rf.gd/rfgd_20339431/htdocs/wp-includes/wp-db.php on line 1562

How can I fix the problem?
I found somebody having nearly the same problem to me:
https://hk.godaddy.com/community/Managing-WordPress/Error-establishing-a-database-connection/td-p/92399

Thank you again for your patience to help.

@wl_402 said:

@Admin said:

@wl_402 said:

@Admin said:

@wl_402 said:
I am using WordPress, but is there a debug mode for WordPress?

Did you try to punch “wordpress debug mode” in Google already (spoilers: there is a WordPress Codex article explaining it all)? Really, search engines are a blessing for website development.

And what @MrJunior said, of course.

I have searched in google and found an article:
How to Fix Error Establishing a Database Connection Error
I thought my database has some problem, so I tried to follow the instructions given and went to the repair site:
windylee.rf.gd/wp-admin/maint/repair.php/
but unlike what the writer got, all I get was the ‘error establishing database connection’ again instead of the page that offers repair options.
I have already enabled the repair function.
I don’t think I have change the login credentials recently.
Is there still any methods that I can try?

The first thing you should do is Enable Debug Mode in WordPress. That’s what you need to Google, not the database connection error. With Debug Mode enabled, you can see the actual error message from the database connection generated by the server.

Sorry, I finally understand the problem.

Now I got these errors:

Warning: mysqli_real_connect(): (HY000/1045): Access denied for user ‘20339431_4’@‘192.168.0.52’ (using password: YES) in /home/vol13_5/rf.gd/rfgd_20339431/htdocs/wp-includes/wp-db.php on line 1531

I’m not sure but it looks like the Username is wrong

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/vol13_5/rf.gd/rfgd_20339431/htdocs/wp-includes/wp-db.php on line 1562

Well, just as what the error said, It is deprecated, Try to use mysqli or PDO to make it work.

Warning: mysql_connect(): Access denied for user ‘20339431_4’@‘192.168.0.52’ (using password: YES) in /home/vol13_5/rf.gd/rfgd_20339431/htdocs/wp-includes/wp-db.php on line 1562
Well O also think this to be wrong username.

@UnknownLolz said:

@wl_402 said:

@Admin said:

@wl_402 said:

@Admin said:

@wl_402 said:
I am using WordPress, but is there a debug mode for WordPress?

Did you try to punch “wordpress debug mode” in Google already (spoilers: there is a WordPress Codex article explaining it all)? Really, search engines are a blessing for website development.

And what @MrJunior said, of course.

I have searched in google and found an article:
How to Fix Error Establishing a Database Connection Error
I thought my database has some problem, so I tried to follow the instructions given and went to the repair site:
windylee.rf.gd/wp-admin/maint/repair.php/
but unlike what the writer got, all I get was the ‘error establishing database connection’ again instead of the page that offers repair options.
I have already enabled the repair function.
I don’t think I have change the login credentials recently.
Is there still any methods that I can try?

The first thing you should do is Enable Debug Mode in WordPress. That’s what you need to Google, not the database connection error. With Debug Mode enabled, you can see the actual error message from the database connection generated by the server.

Sorry, I finally understand the problem.

Now I got these errors:

Warning: mysqli_real_connect(): (HY000/1045): Access denied for user ‘20339431_4’@‘192.168.0.52’ (using password: YES) in /home/vol13_5/rf.gd/rfgd_20339431/htdocs/wp-includes/wp-db.php on line 1531

I’m not sure but it looks like the Username is wrong

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/vol13_5/rf.gd/rfgd_20339431/htdocs/wp-includes/wp-db.php on line 1562

Well, just as what the error said, It is deprecated, Try to use mysqli or PDO to make it work.

Warning: mysql_connect(): Access denied for user ‘20339431_4’@‘192.168.0.52’ (using password: YES) in /home/vol13_5/rf.gd/rfgd_20339431/htdocs/wp-includes/wp-db.php on line 1562
Well O also think this to be wrong username.

Thank you for your help.
What does it mean by ‘use mysqli or PDO instead’? Does it mean I have to make changes in wp-config.php? Or where should I change the username?

I changed the username in wp-config.php
and the error message becomes

Warning: mysqli_real_connect(): (HY000/1045): Access denied for user ‘mysqli’@‘192.168.0.52’ (using password: YES) in /home/vol13_5/rf.gd/rfgd_20339431/htdocs/wp-includes/wp-db.php on line 1531

Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/vol13_5/rf.gd/rfgd_20339431/htdocs/wp-includes/wp-db.php on line 1562

Warning: mysql_connect(): Access denied for user ‘mysqli’@‘192.168.0.52’ (using password: YES) in /home/vol13_5/rf.gd/rfgd_20339431/htdocs/wp-includes/wp-db.php on line 1562

Also, how can I know the correct username and password?

To know your password:

  1. Go to the client area
  2. Go to the “Manage account” section.
  3. You’ll see 2 equal password of your cPanel, it’s hidden by default and can be shown with button aside, this is kinda universal password for ftp/cpanel/databases.

@MrJunior said:
To know your password:

  1. Go to the client area
  2. Go to the “Manage account” section.
  3. You’ll see 2 equal password of your cPanel, it’s hidden by default and can be shown with button aside, this is kinda universal password for ftp/cpanel/databases.

Thank you. What about the username? What username should I use? I have tried both ‘PDO’ and ‘mysqli’ in the wp-config.php but it didn’t work.

Also, should all these changes be done on the ‘wp-config.php’ ?

Sorry, everything is solved now. Thank you very much for all your help. I discovered that both the usernames, passwords and host names for the database are wrong and caused this error. I changed those things and everything is restored.

Thank you everyone again for you help.

A little question: I did not even do anything on the wp-config.php before this error occurred. What will cause this error?

If this is technical issues - maybe something gone wrong on IF servers.
Probably it is WP issues - you’ve clicked something wrong, or whatsoever else could happen, I never worked with WP…

@wl_402 said:
Sorry, everything is solved now. Thank you very much for all your help. I discovered that both the usernames, passwords and host names for the database are wrong and caused this error. I changed those things and everything is restored.

Thank you everyone again for you help.

A little question: I did not even do anything on the wp-config.php before this error occurred. What will cause this error?

Softaculous does something special with the database credentials. I don’t know how or why it creates the credentials like that, but it should work. As to why it doesn’t work anymore, I don’t have a clue.