SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Aug 2002
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Create User Confusion

    Hi

    I have some confusion regarding creating new users. I recently set up a new Redhat installation and in doing this I installed phpMyAdmin for the root user, no probs here. Then I created a database I needed and imported all the necessary data, no probs here either.

    Then I created a user for the database by entering the following query in phpMyAdmin:

    GRANT
    SELECT, INSERT, UPDATE, DELETE, CREATE, DROP
    ON myDB.*
    TO myUser@localhost
    IDENTIFIED BY 'myUserPW';
    From this a new entry is created in the MYSQL database USER table, as you would expect. But the following script returns
    'NO'.
    PHP Code:
    $dbCon mysql_connect('localhost''myUser''myUserPW');
    $dbCon mysql_select_db('myDB'$dbCon);

    if (
    mysql_query('SELECT (1 + 1) AS Sum'$dbCon)) echo 'YES';
    else echo 
    'NO'
    When viewing the contents of the MYSQL USER table the user 'myUser' is in the table and all the privileges are set to 'N'. When running the query 'SHOW GRANTS FOR myUser@localhost' the following two rows are returned:

    GRANT USAGE ON *.* TO 'myUser'@'localhost' IDENTIFIED BY PASSWORD '222222222222222'
    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON myDB.* TO 'myUser'@'localhost'

    I tried running the query FLUSH PRIVILEGES but that didn't help. I don't understand a few of things here so my questions are this:

    1. Obviously the database connection is not working for the user, any idea why?
    2. In the MYSQL USER table why are all the privileges set to 'N', yet obviously from the SHOW GRANTS query the necessary privileges are set. Why is that?
    3. The SHOW GRANTS query returns 'GRANT USAGE ON *.*' does this mean that the user usage on all databases now?

    I've been using MYSQL for a while now but these problems are still mystery to me. I am sure that I have followed these exact steps previously and they have worked. So I am a bit confused and all help is greatly appreciated.

    Thx in advance!

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Restart MySql?

  3. #3
    SitePoint Addict
    Join Date
    Mar 2002
    Location
    Los Angeles
    Posts
    325
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am running into the same exact problem now, did you ever get this resolved?

    I cannot connect to mysql witht he two users i created, and its driving me crazy.
    From here on, it's instinctual...even straight roads meander.

  4. #4
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    new user creation problems

    Quote Originally Posted by grahowler
    Hi

    I have some confusion regarding creating new users. I recently set up a new Redhat installation and in doing this I installed phpMyAdmin for the root user, no probs here. Then I created a database I needed and imported all the necessary data, no probs here either.

    Then I created a user for the database by entering the following query in phpMyAdmin:

    GRANT
    SELECT, INSERT, UPDATE, DELETE, CREATE, DROP
    ON myDB.*
    TO myUser@localhost
    IDENTIFIED BY 'myUserPW';
    From this a new entry is created in the MYSQL database USER table, as you would expect. But the following script returns
    'NO'.
    PHP Code:
    $dbCon mysql_connect('localhost''myUser''myUserPW');
    $dbCon mysql_select_db('myDB'$dbCon);

    if (
    mysql_query('SELECT (1 + 1) AS Sum'$dbCon)) echo 'YES';
    else echo 
    'NO'
    When viewing the contents of the MYSQL USER table the user 'myUser' is in the table and all the privileges are set to 'N'. When running the query 'SHOW GRANTS FOR myUser@localhost' the following two rows are returned:

    GRANT USAGE ON *.* TO 'myUser'@'localhost' IDENTIFIED BY PASSWORD '222222222222222'
    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON myDB.* TO 'myUser'@'localhost'

    I tried running the query FLUSH PRIVILEGES but that didn't help. I don't understand a few of things here so my questions are this:

    1. Obviously the database connection is not working for the user, any idea why?
    2. In the MYSQL USER table why are all the privileges set to 'N', yet obviously from the SHOW GRANTS query the necessary privileges are set. Why is that?
    3. The SHOW GRANTS query returns 'GRANT USAGE ON *.*' does this mean that the user usage on all databases now?

    I've been using MYSQL for a while now but these problems are still mystery to me. I am sure that I have followed these exact steps previously and they have worked. So I am a bit confused and all help is greatly appreciated.

    Thx in advance!
    well buddy I think I found out what's wrong:
    GRANT
    SELECT, INSERT, UPDATE, DELETE, CREATE, DROP
    ON myDB.*
    TO myUser@localhost
    IDENTIFIED BY 'myUserPW';
    you dont want to use that, try something like this:
    GRANT SELECT, INSERT, UPDATE, DELETE CREATE, DROP, ALTER ON myDB.* to 'myNewUser'@'localhost' IDENTIFIED BY 'myNewPassword' with grant options;

    try something like that and see if that works for ya


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
  •