Correct Code To Add A User To DB

Discussion in 'MySQL' started by Googledeez, Jul 27, 2007.

  1. #1
    Can someone help me here. I am missing something very minor, but I'm not sure what. The MYSQL manual was a bit confusing.

    Thanks.



    syntax MSQL 4.1.21

    Error

    SQL query:

    mysql > GRANT ALL ON DB NAME TO username IDENTIFIED BY 'password'

    MySQL said: Documentation
    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near mysql > GRANT ALL ON DB NAME TO username IDENTIFIED BY 'password' at line 1
     
    Googledeez, Jul 27, 2007 IP
  2. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #2
    Not an expert.

    I think the proper form is:

    GRANT ALL PRIVILAGES ON dbname.* TO username@localhost IDENTIFIED BY 'password'

    The .* after the dbname indicates access to all table in the database.
     
    Colbyt, Jul 27, 2007 IP