Access denied for user

Discussion in 'MySQL' started by MySQLGEEK, Aug 29, 2006.

  1. MySQLGEEK

    MySQLGEEK New Member

    Joined:
    Aug 29, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    I tried the GRANT syntax, but I too am having this problem.

    PLEASE HELP. This is frustrating. I am new to MySQL.

    Cannot connect as anything other than root, using shell or PHP pages on localhost.

    Here's my error:

    [in shell]
    ERROR 1045: Access denied for user: 'greg@localhost' (Using password: YES)

    [in php page]
    Warning: Access denied for user: 'greg@localhost' (Using password: YES) in /[...]/dbtest.php on line 14

    (I'm developing under OS X 10.1, but that should not make a difference).
     
  2. pete_bisby

    pete_bisby New Member

    Joined:
    Nov 11, 2007
    Messages:
    48
    Likes Received:
    2
    Trophy Points:
    0
    Occupation:
    Software Developer/Analyst, PB
    Location:
    Manchester, England
    Home Page:
    http://www.pbworld.co.uk
    Section 5.9 of the MySQL Manual: User Management

    Use the GRANT statement to create new user accounts. e.g.:
    Code:
    GRANT ALL PRIVILEGES ON *.* TO 'user1'@'localhost' IDENTIFIED BY 'a_passwd';
    
    This will create a user account with the username "user1" allowed access to all databases on the server with the password "a_passwd", which will be encrypted.

    So with this you will need the following SQL statement:
    Code:
    GRANT ALL PRIVILEGES ON *.* TO 'greg'@'localhost' IDENTIFIED BY 'a_passwd';
    
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice