Jump to content

Archived

This topic is now archived and is closed to further replies.

mysty

mysql connect problems

Recommended Posts

From the cmd prompt, I can get into mysql using the "root" user and when I use phpmyadmin, everything seems to work OK.

When I enter this in DW8, I get the something's wrong error:

<?php
$connect = mysql_connect ("localhost", "host", "fakepw") or die ("something's wrong");
?>

I can also enter this and get the error:

<?php
mysql_ping (link_id) or die ("something's wrong");
?>

I believe everything is set correctly according to phpinfo.  What am I missing?

My setup is using Apache2triad that uses
Apache 2.2.0
MySQL 5.0.11
PHP 5.1.2

Share this post


Link to post
Share on other sites
Try this:
[code]$connect = mysql_connect ("localhost", "host", "fakepw") or die ("Unable to connect to the database: " . mysql_error()); [/code]
It should now return an erroir message from mysql this time, which should tell you why it is failing.

Share this post


Link to post
Share on other sites
Unable to connect to the database: Access denied for user 'host'@'localhost' (using password: YES)

Thanks, I think I figured this out.  The message above shows the user to be host when it should be root.  I changed to root and got no error message, so assume it is now working.

Share this post


Link to post
Share on other sites
Yeah if its not returning any errors, then it successfully connect to the MySQL server.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.