SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2002
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mySQL GRANT problems

    I am trying to create a new user who only has permission to view contents. I don't seem to be able to make this work.

    Here is what I typed in the consol;

    mysql> GRANT SELECT
    -> on Jokes.*
    -> to user
    -> identified by '1234';
    Query OK, 0 rows affected (0.00 sec)

    This is what's in my .php script:

    $dbcnx = @mysql_connect("localhost", "user", "1234");

    I get an error "unable to connect to server", I can only get the root user to work. Matter of fact I can't get these to work either:

    mysql> SHOW GRANTS;
    ERROR 1064: You have an error in your SQL syntax near '' at line 1
    mysql> -h localhost -u user -p 1234
    -> ;
    ERROR 1064: You have an error in your SQL syntax near '-h localhost -u user -p 1
    234' at line 1
    mysql>

    What am I doing wrong?

  2. #2
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this instead:
    mysql> GRANT SELECT
    -> on Jokes.*
    -> to user@localhost
    -> identified by '1234';

    you need to enter the host your user is coming from... you can use the wildcard operator too (as in user@*...) read this

    also, SHOW GRANTS should be SHOW GRANTS for user@localhost...

    and this: -h localhost -u user -p 1234
    read your other post in the 'Files, Databases and XML' forum...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •