3

How can I give one user the identical set of privileges as another (pre-existing) user?

I can do:

SHOW GRANTS FOR 'user1'

But not:

GRANT (SHOW GRANTS for 'user1') to 'user2';

or

CREATE USER 'user1' LIKE 'user2'

So I can't see a way programmatically add all these grants a different user2 in an SQL way (other than writing a script in an app language to iterate thru that SHOW GRANTS)

Maybe there is a way going to the mysql.user table? Or is that a bad idea in general? I am not particularly knowledgeable about, or comfortable messing around with, that table.

Filburt
  • 17,626
  • 12
  • 64
  • 115
jon_darkstar
  • 16,398
  • 7
  • 29
  • 37
  • 1
    [MySQL Utilities](https://dev.mysql.com/downloads/utilities/) provide a tool, [mysqluserclone](https://dev.mysql.com/doc/mysql-utilities/en/mysqluserclone.html), that does exactly what you want. Otherwise, you can indeed effect such a change by operating on the [Privilege System Grant Tables](https://dev.mysql.com/doc/en/grant-table-structure.html) directly (provided that you `FLUSH PRIVILEGES` when you're done). – eggyal Sep 22 '15 at 19:50

0 Answers0