Search code examples
mysqlpermissionsbulk

MySQL bulk permissions


Is there any way to grant bulk permissions in MySQL to several users (on the same database) whose username is equal to all of them but not their hostname/IP?

I mean users like these:

user@192.168.0.1,user@192.168.0.2 and so on.


Solution

  • If your users already exist, you can use the following syntax:

    GRANT SELECT,INSERT,UPDATE ON testDatabase.*
    TO 'user', 'admin', 'root', 'john'
    

    You can not specify the @ tag for this particular operation. The users must be defined before running the GRANT