This was one of those nuggets that are hard to find quickly when you need them. And you have to remember to flush the privs afterwards, or you will be scratching your head wondering why it’s not working.
[I no longer have the source for this, but thanks to whoever/wherever it was from.]
To set up this user’s privileges using GRANT statements, run these commands:
mysql> GRANT ALL PRIVILEGES ON *.* TO monty@localhost
IDENTIFIED BY ‘some_pass’ WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO monty@”%”
IDENTIFIED BY ‘some_pass’ WITH GRANT OPTION;
mysql> GRANT RELOAD,PROCESS ON *.* TO admin@localhost;
mysql> GRANT USAGE ON *.* TO dummy@localhost;
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
ON bankaccount.*
TO custom@localhost
IDENTIFIED BY ‘stupid’;
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
ON expenses.*
TO custom@whitehouse.gov
IDENTIFIED BY ‘stupid’;
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
ON customer.*
TO custom@’%’
IDENTIFIED BY ‘stupid’;
THEN flush the privs for them to take effect
Related posts: