Database Connection Failed

Status
Not open for further replies.

asvabjob

New Member
Messages
7
Reaction score
0
Points
1
I'm having problems connecting to my database. I get the following error message: Connection failed: SQLSTATE[HY000] [2002] Connection refused
 

rmsx10ho

Member
Messages
159
Reaction score
13
Points
18
What app are you wanting to run with a data base? WordPress etc?
 

rmsx10ho

Member
Messages
159
Reaction score
13
Points
18
My data base driven CMS on the same free service is OK

You 100% sure your own code is OK?
 
Last edited:

asvabjob

New Member
Messages
7
Reaction score
0
Points
1
Yes. I've got it working on my Apache virtual server via Netbeans and xampp. Also, I have it working for a different site that's hosted by hostgator: charlestonandlowcountry.com
 

lylex10h

Active Member
Messages
982
Reaction score
71
Points
28
Can you provide the code of the connection string? Just replace the password with *s
 

Livewire

Abuse Compliance Officer
Staff member
Messages
18,169
Reaction score
216
Points
63
Near as I can tell from reading the configuration file, your connection string isn't quite right. For privacy I won't paste it here (even without a password), but your database name should be preceded with your cPanel name. Yours has a typo in it however; there's a letter missing (typo). You also should only be using 'localhost' as the host; adding the port number isn't needed as it's on the default port, and from my understanding adding it can cause some problems with the firewalls as it may think you're attempting to access MySQL remotely, which isn't allowed on free hosting.

I'd first recommend fixing the database name as that may be enough to fix it; if not, changing it to just localhost is next. With that, you should at least be able to connect, and anything else wrong should return a good MySQL error that can be used to fix any new problems :)
 

asvabjob

New Member
Messages
7
Reaction score
0
Points
1
Near as I can tell from reading the configuration file, your connection string isn't quite right. For privacy I won't paste it here (even without a password), but your database name should be preceded with your cPanel name. Yours has a typo in it however; there's a letter missing (typo). You also should only be using 'localhost' as the host; adding the port number isn't needed as it's on the default port, and from my understanding adding it can cause some problems with the firewalls as it may think you're attempting to access MySQL remotely, which isn't allowed on free hosting.

I'd first recommend fixing the database name as that may be enough to fix it; if not, changing it to just localhost is next. With that, you should at least be able to connect, and anything else wrong should return a good MySQL error that can be used to fix any new problems :)

Thanks Livewire, It was a simple error as you suggested. Everything is good to go now.
 

asvabjob

New Member
Messages
7
Reaction score
0
Points
1
Thanks, Livewire. It was a simple error, misspelled username, Everything is working well now.
 
Status
Not open for further replies.
Top