MAMP user can't connect to Database

David B

Registered
I installed MAMP on my MacBook Pro and finally got my virtual hosts and .htaccess files to work. However, I'm using the default Apache installation, rather than MAMP's Apache version (which could possibly be the problem).

Anyway, I can access my databases and manipulate tables with phpMyAdmin, yet I can't connect to my databases with Dreamweaver. I accidentally deleted the database "test," but I created a new one named Test2. I haven't created a password or username on anything. When I open Test2 and click Privileges, this is what I see:

Code:
User  	Host  	Type  	Privileges  	Grant 
root 	localhost 	global 	ALL PRIVILEGES 	Yes
root 	webeditions-computer.local 	global 	ALL PRIVILEGES 	Yes

This is what my database connection in Dreamweaver looks like:

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

But when I preview a page, I get this error message:

Code:
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 16
Access denied for user 'root'@'localhost' (using password: NO)

Root would have to be the correct username, wouldn't it? And wouldn't I just type in a pair of quotes - "" - where the password would be? What else could be the problem?

I had a hunch it might have something to do with my dual Apache installation, but I don't know how to troubleshoot that. Any tips?

Thanks.
 
Back
Top