1
votes

I have banging my head here for hours.

I am adding a user, password to a DB, whilst trying to grant Privileges.

GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON myDB.* TO MyUser@localhost IDENTIFIED BY 'Mypass'; 

This creates the user, adds the password but will not grant for some reason

I can then run

select * from mysql.user \G;

And it returns the following output, as you can see no grants

*************************** 6. row ***************************
                  Host: localhost
                  User: MyUser
              Password: *MyPass
           Select_priv: N
           Insert_priv: N
           Update_priv: N
           Delete_priv: N
           Create_priv: N
             Drop_priv: N
           Reload_priv: N
         Shutdown_priv: N
          Process_priv: N
             File_priv: N
            Grant_priv: N
       References_priv: N
            Index_priv: N
            Alter_priv: N
          Show_db_priv: N
            Super_priv: N
 Create_tmp_table_priv: N
      Lock_tables_priv: N
          Execute_priv: N
       Repl_slave_priv: N
      Repl_client_priv: N
      Create_view_priv: N
        Show_view_priv: N
   Create_routine_priv: N
    Alter_routine_priv: N
      Create_user_priv: N
            Event_priv: N
          Trigger_priv: N
Create_tablespace_priv: N
              ssl_type:
            ssl_cipher:
           x509_issuer:
          x509_subject:
         max_questions: 0
           max_updates: 0
       max_connections: 0
  max_user_connections: 0
                plugin:
 authentication_string: NULL

Any help with this would be great

PS

If I run

GRANT ALL ON *.* TO 'MyUser'@'localhost';

All privileges are added

1
Possible duplicate of Why is GRANT not working in MySQL?Viktor

1 Answers

1
votes

You are looking at global permissions, but only grant permissions for myDB.*.

Database-wide permissions are stored in the table mysql.db, take a look at that one.

See the manual for specific information which information is stored where: https://dev.mysql.com/doc/refman/5.5/en/grant-tables.html