Error Establishing a Database Connection

GreatBrittain

Registered
Sep 30, 2021
4
0
1
USA
cPanel Access Level
Website Owner
Hi Guys, I am facing "Error Establishing a Database Connection" from the last 1.5 month on my website. I didn't get the solution yet. Please Seniors Help me on urgent basis. Thanks in Advance
 
Last edited by a moderator:

GreatBrittain

Registered
Sep 30, 2021
4
0
1
USA
cPanel Access Level
Website Owner
Hey there! I see your site is based on WordPress, so you'd want to check the username and password that is stored in /home/username/public_html/wp-config.php to ensure that is able to connect to the database on the server.
i have done the same method but still no progress
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,519
1,028
313
cPanel Access Level
Root Administrator
Are you able to confirm that user can connect on the command line to the database? You would run this command to test it:

Code:
mysql -u database_username -p
Just replace "database_username" with your actual username and it would prompt you with the password. If that connection works, there must be some other issue happening, and you'd want to check the MySQL log on the system to determine the problem.
 
  • Like
Reactions: GreatBrittain

radeonpower

Well-Known Member
Jul 23, 2009
149
4
68
Iceland
cPanel Access Level
Root Administrator
I found the issue, it seems when I transferred the accounts via the Transfer tool to a new server the privileges were lost for the user to the db. Never had that problem before.
Using latest cPanel and MariaDB 10.5.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,519
1,028
313
cPanel Access Level
Root Administrator
That's definitely odd - I would have expected there to have been some type of error listed in the transfer log. If you want us to take a look at the system and see if we can find any details feel free to submit a ticket to our team, and then post the number here.
 

radeonpower

Well-Known Member
Jul 23, 2009
149
4
68
Iceland
cPanel Access Level
Root Administrator
Here is an example from logs.

The system received an error from the “MySQL” database “mysql”: ER_PASSWORD_NO_MATCH (Can't find any matching row in the user table)",null],[["MysqlBase","_do_cpanel_mysql_with_newuser_privs",602],"The system failed to grant privileges on the database “website1_wp340” to the user “website1_wp340” because of an error: (XID bkfm83)