Jump to content


Photo

mysql connect problems


  • Please log in to reply
3 replies to this topic

#1 mysty

mysty
  • Members
  • PipPipPip
  • Advanced Member
  • 83 posts

Posted 30 July 2006 - 02:44 AM

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

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 30 July 2006 - 10:37 AM

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

#3 mysty

mysty
  • Members
  • PipPipPip
  • Advanced Member
  • 83 posts

Posted 30 July 2006 - 12:03 PM

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.

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 30 July 2006 - 05:30 PM

Yeah if its not returning any errors, then it successfully connect to the MySQL server.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users