Keep Getting the 'Cannot connect to database'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gourk
    New Member
    • Jan 2008
    • 4

    #1

    Keep Getting the 'Cannot connect to database'

    I'm fairly new to the whole MySQL thing, But not new to SQL. So doing most of this was fairly easy, but I have a hosting service with Godaddy.com, and Yes it supports MySQL 5.0 and is installed and working. I'm trying to setup a basic news script for a upcoming website I have and I just wanted to dink around with it before I have everything up and going - But I seem to have a problem I keep coming across. Either my Screen will NOT show anything or will show Cannot connect to database. Now I have the database name correct, Everything should be correct.


    <?php
    $dbhost='host';
    $dbusername='us ername';
    $dbuserpass='pa ss';
    $dbname = 'cossmoss';
    ?>

    I left the db name. But I'm not 100% sure on how the dbhost is suppose to be setup, Since it is a remote connection. Any light to shed on this would be greatly appericate I've been stumped for the past 4 hours lol.

    I've trying some of the following dbhost setups

    ipipip.hostname
    hostname.com:80 (80 being the port I think lol)
    ipipipip
    databasename:80
  • stepterr
    New Member
    • Nov 2007
    • 157

    #2
    Originally posted by Gourk
    I'm fairly new to the whole MySQL thing, But not new to SQL. So doing most of this was fairly easy, but I have a hosting service with Godaddy.com, and Yes it supports MySQL 5.0 and is installed and working. I'm trying to setup a basic news script for a upcoming website I have and I just wanted to dink around with it before I have everything up and going - But I seem to have a problem I keep coming across. Either my Screen will NOT show anything or will show Cannot connect to database. Now I have the database name correct, Everything should be correct.


    <?php
    $dbhost='host';
    $dbusername='us ername';
    $dbuserpass='pa ss';
    $dbname = 'cossmoss';
    ?>

    I left the db name. But I'm not 100% sure on how the dbhost is suppose to be setup, Since it is a remote connection. Any light to shed on this would be greatly appericate I've been stumped for the past 4 hours lol.

    I've trying some of the following dbhost setups

    ipipip.hostname
    hostname.com:80 (80 being the port I think lol)
    ipipipip
    databasename:80
    I also use a hosting service, not GoDaddy though, so it may be different. But on mine I can just put the following.

    [PHP]$dbhost = "localhost" ;[/PHP]

    I'd give that a try if I were you. Good luck!

    Comment

    • Gourk
      New Member
      • Jan 2008
      • 4

      #3
      Well appericate the helping hand, but alas it still does not work.


      BUT I think I have found the problem, when setting up the php/mysql I didn't check install DSN LOL

      Comment

      • Gourk
        New Member
        • Jan 2008
        • 4

        #4
        Hrm nvm, That is not even needed. I'm still having the same problem. It's like my hosting isn't even able to support php, I'm constantly seeing a White Screen. I even copied EXCALTY the information (username/databasename.. etc) from the godaddy information they gave me to the connect.php file =x

        Comment

        • Gourk
          New Member
          • Jan 2008
          • 4

          #5
          FINALLY. Thanks for even posting m8, I finally got it to work.. I just had to read up on some documention on godaddy.com on their service, Come to find out it was on a linux server.. I was posting windows commands on it lol :P

          Comment

          Working...