Can't get Dreamweaver to connect to MySQL Server (on localhost)

Discussion in 'Mac Apps and Mac App Store' started by edesignuk, Nov 7, 2004.

  1. edesignuk Moderator emeritus

    edesignuk

    Joined:
    Mar 25, 2002
    Location:
    London, England
    #1
    I setup MySQL under Panther last week, it's installed an working (see attachment 1), I can see it's running, and that databases exist in it. I can even install a forum package like IPB, or vB, and it will connect to the local MySQL Server and install itself and run with no problems.
    I also have a couple of PHP files that are part of a tutorial I was running though, this is the code for them:
    PHP:
     $user="root";
     
    $password="???????";
     
    $database="DEV_DB";
     
    mysql_connect(localhost,$user,$password);
     @
    mysql_select_db($database) or die( "Unable to select database");
     
    $query="CREATE TABLE ITSC_INTRANET (SCROLLER text)";
     
    mysql_query($query);
     
    mysql_close();
    PHP:
     $user="root";
     
    $password="???????";
     
    $database="DEV_DB";
     
    mysql_connect(localhost,$user,$password);
     @
    mysql_select_db($database) or die( "Unable to select database");
     
    $query="INSERT INTO ITSC_INTRANET VALUES ('There are no alerts at present.')";
     
    mysql_query($query);
     
    mysql_close();
    If I "run" these pages the data is entered into the database, again proof that everything is working properly.

    But, I have a site setup in DW MX 2004 as a PHP MySQL site, and when I make a new connection (using the "wizard") I get this error (see attachment 2).

    Any idea what's going on here? I know that MySQL is running, and I know it can be accessed. I don't know s*** about MySQL, so I'm totally confused by this.
     

    Attached Files:

  2. edesignuk thread starter Moderator emeritus

    edesignuk

    Joined:
    Mar 25, 2002
    Location:
    London, England
  3. Rower_CPU Moderator emeritus

    Rower_CPU

    Joined:
    Oct 5, 2001
    Location:
    San Diego, CA
    #3
    Looks like the URL prefix you entered for the site might not be taking correctly. Are you trying to access from your user folder's site directory or /Library/WebServer/?

    PS. You've got a root password showing in plain text in that error message you might want to blur out. ;)
     
  4. edesignuk thread starter Moderator emeritus

    edesignuk

    Joined:
    Mar 25, 2002
    Location:
    London, England
    #4
    The root of the site is ~/Sites/lsc/ (http://localhost/~jelliott/lsc/).

    I know the pwd is there, couldn't be bothered to blur it, and it doesn't really matter, it's only a local SQL install :)
     
  5. edesignuk thread starter Moderator emeritus

    edesignuk

    Joined:
    Mar 25, 2002
    Location:
    London, England
    #5
    Even if I setup a site in /Library/Webserver/Documents (http://localhost/) I still get the same error. It's really weird.
     
  6. Rower_CPU Moderator emeritus

    Rower_CPU

    Joined:
    Oct 5, 2001
    Location:
    San Diego, CA
    #6
    Hmmm, and that error message pops up when you click the "Test URL" button, right?
     
  7. edesignuk thread starter Moderator emeritus

    edesignuk

    Joined:
    Mar 25, 2002
    Location:
    London, England
    #7
    I enter all the details for the connection, hit "Test", and get the error.
     
  8. Rower_CPU Moderator emeritus

    Rower_CPU

    Joined:
    Oct 5, 2001
    Location:
    San Diego, CA
    #8
    Just noticed I'm only on MX here at home (work has MX 2004) so my steps are a bit different than yours. I'll try at work tomorrow to see how it goes, if you haven't already found a solution by then.
     
  9. edesignuk thread starter Moderator emeritus

    edesignuk

    Joined:
    Mar 25, 2002
    Location:
    London, England
    #9
    Thank you very much, I really appreciate the help!
     
  10. jeremy.king macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #10
    The key is in that URL - looks like its passing connection information in the query string.

    Is your database server listening for requests where hostname=imacg5.ad.home?

    Notice the "host=" parameter is passing your machine host name instead of "localhost".

    You should verify your machine will answer db requests using the mysql command in Terminal

    PHP:
    mysql -h imacg5.ad.home -u root -p
    If it doesn't answer (ie prompt you for password), there are a couple workarounds like modifying your hosts file - for example.
     

Share This Page