PDA

View Full Version : Can't get Dreamweaver to connect to MySQL Server (on localhost)




edesignuk
Nov 7, 2004, 04:53 PM
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:

$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();


$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.



edesignuk
Nov 8, 2004, 03:32 PM
Little help?

Rower_CPU
Nov 8, 2004, 04:42 PM
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. ;)

edesignuk
Nov 8, 2004, 04:45 PM
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 :)

edesignuk
Nov 8, 2004, 04:50 PM
Even if I setup a site in /Library/Webserver/Documents (http://localhost/) I still get the same error. It's really weird.

Rower_CPU
Nov 8, 2004, 04:53 PM
Hmmm, and that error message pops up when you click the "Test URL" button, right?

edesignuk
Nov 8, 2004, 04:58 PM
I enter all the details for the connection, hit "Test", and get the error.

Rower_CPU
Nov 8, 2004, 05:06 PM
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.

edesignuk
Nov 8, 2004, 05:09 PM
Thank you very much, I really appreciate the help!

jeremy.king
Nov 8, 2004, 06:04 PM
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

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.