Database Connection Failed

Discussion in 'Free Hosting' started by asvabjob, May 10, 2018.

  1. asvabjob

    asvabjob New Member

    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    I'm having problems connecting to my database. I get the following error message: Connection failed: SQLSTATE[HY000] [2002] Connection refused
     
  2. rmsx10ho

    rmsx10ho Member

    Messages:
    111
    Likes Received:
    8
    Trophy Points:
    18
    What app are you wanting to run with a data base? WordPress etc?
     
  3. asvabjob

    asvabjob New Member

    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    It’s my own CMS - my code
     
  4. rmsx10ho

    rmsx10ho Member

    Messages:
    111
    Likes Received:
    8
    Trophy Points:
    18
    My data base driven CMS on the same free service is OK

    You 100% sure your own code is OK?
     
    Last edited: May 11, 2018
  5. asvabjob

    asvabjob New Member

    Messages:
    7
    Likes Received:
    0
    Trophy 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
     
  6. lylex10h

    lylex10h Active Member

    Messages:
    792
    Likes Received:
    53
    Trophy Points:
    28
    Can you provide the code of the connection string? Just replace the password with *s
     
  7. Livewire

    Livewire Abuse Compliance Officer Staff Member

    Messages:
    18,151
    Likes Received:
    214
    Trophy 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 :)
     
    • Informative Informative x 1
  8. asvabjob

    asvabjob New Member

    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Thanks Livewire, It was a simple error as you suggested. Everything is good to go now.
     
    • Winner Winner x 1
  9. asvabjob

    asvabjob New Member

    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Thanks, Livewire. It was a simple error, misspelled username, Everything is working well now.
     
    • Winner Winner x 1

Share This Page