List:General Discussion« Previous MessageNext Message »
From:David Blomstrom Date:March 26 2007 9:29pm
Subject:Database Connection Problem with MAMP (Mac)
View as plain text  
I installed a preconfigured package called MAMP on my MacBook Pro and have just about
everything working except my database connections. I can use phpMyAdmin to manipulate
databases and tables, but I can't connect to those databases from Dreamweaver.

I read somewhere that you have to use a special username (or host?) if your components are
running on different servers. I have two Apache installations running, with the default
installation running the show. In other words, phpMyAdmin is running with the original
Apache, not MAMP's Apache (at least, I think so).

Anyway, I created a user named 127.0.0.1, which I believe is my webserver's IP address. I
assigned no password. This is what my connection looks like:

$link = mysql_connect ("127.0.0.1" , "" , "") or die(mysql_error());
mysql_select_db ("WebServer", $link) or die(mysql_error());

I also tried it with host also designated 127.0.0.1...

$link = mysql_connect ("127.0.0.1" , "127.0.0.1" , "") or die(mysql_error());

mysql_select_db ("WebServer", $link) or die(mysql_error());

Access denied for user ''@'localhost' to database 'webserver'

* * * * *

This database connection...

$link = mysql_connect ("localhost" , "root" , "") or die(mysql_error());
mysql_select_db ("Test2", $link) or die(mysql_error());

...yields this error:

Warning:  mysql_connect() [function.mysql-connect]: Access denied for user
'root'@'localhost' (using password: NO) in /Users/davidblomstrom/Sites/Geobop/a1/dbc.php
on line 21

Access denied for user 'root'@'localhost' (using password: NO)

* * * * *

The only database I could connect to without an error message was the default database
"test," which I accidentally dropped. The weird thing is that I couldn't connect to it if
I designated "root" as the username; rather, there was no error only if I used anything
BUT root, even though the usernames I assigned didn't even exist. So I don't think I was
really connected.

I've seen some sources that talk about "symlinking" MySQL (or phpMyAdmin?) if Apache is on
a different server. Could that be the problem? If not, does anyone know how I can
troubleshoot this?

Thanks.





 
____________________________________________________________________________________
It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/
Thread
Database Connection Problem with MAMP (Mac)David Blomstrom26 Mar