PDA

View Full Version : Need help connecting to mysql




antoneoh
Mar 31, 2008, 11:35 AM
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.



macgruder
Mar 31, 2008, 01:30 PM
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?

angelwatt
Mar 31, 2008, 05:50 PM
Try
$link = mysql_connect('localhost:8889','root','root');

antoneoh
Mar 31, 2008, 08:28 PM
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
Mar 31, 2008, 10:34 PM
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
May 3, 2008, 04:55 PM
here is the doc site for MySQL there are answers, you will need to do a bit of search for the right doc.