Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

antoneoh

macrumors newbie
Original poster
Jun 12, 2007
21
0
Hi, Im learning php and mysql with MAMP. I'm trying to connect to the database. Heres the php code Im using.

$link = mysql_connect('localhost','root','root');

Can anyone help me? I attached an image of the error I get, thanks.
 

Attachments

  • screenshot.gif
    screenshot.gif
    8 KB · Views: 107

macgruder

macrumors 6502
Oct 29, 2007
280
0
UK
Hi, Im learning php and mysql with MAMP. I'm trying to connect to the database. Heres the php code Im using.

$link = mysql_connect('localhost','root','root');

Can anyone help me? I attached an image of the error I get, thanks.

password?
 

antoneoh

macrumors newbie
Original poster
Jun 12, 2007
21
0
The password is root.

I did try changing to localhost:8889 but I got the same error.

I enabled php through the terminal a few months ago, would that be causing the error? If so, how would I disable php through the terminal?
 

angelwatt

Moderator emeritus
Aug 16, 2005
7,852
9
USA
When I was searching for ideas before I came across some comments that made it sound like this issue can arise when switching from PHP4 to PHP5. Have you done that? MAMP does have that option if I remember correctly, and it enables PHP for you so you shouldn't have needed to do anything from Terminal yourself. Maybe that was an issue. Maybe there is two version running causing some confusion.
 

clause

macrumors newbie
Feb 9, 2008
6
0
try this

here is the doc site for MySQL there are answers, you will need to do a bit of search for the right doc.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.