Jump to content

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
Link to comment
https://forums.phpfreaks.com/topic/15985-mysql-connect-problems/
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.
Link to comment
https://forums.phpfreaks.com/topic/15985-mysql-connect-problems/#findComment-65803
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.
Link to comment
https://forums.phpfreaks.com/topic/15985-mysql-connect-problems/#findComment-65861
Share on other sites

Archived

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

×
×
  • Create New...

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.