Need help connecting to mysql

Discussion in 'Web Design and Development' started by antoneoh, Mar 31, 2008.

  1. macrumors newbie

    Joined:
    Jun 12, 2007
    #1
    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.
     

    Attached Files:

  2. macrumors 6502

    Joined:
    Oct 29, 2007
    Location:
    UK
    #2
    password?
     
  3. Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #3
    Try
    PHP:
    $link mysql_connect('localhost:8889','root','root');
     
  4. thread starter macrumors newbie

    Joined:
    Jun 12, 2007
    #4
    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?
     
  5. Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #5
    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.
     
  6. macrumors newbie

    Joined:
    Feb 9, 2008
    #6
    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.
     

Share This Page