MySQL has always been one of the most used database engine for websites. Its security is really important, isolating and managing access must be taken in consideration.
Hereafter are some commands to perform some checking and some updates.
I will consider those variables for my examples, but you should customize them with your own:
- Show permissions for user myuser on server myfirewalleddomain.local :
show grants for 'myuser'@'myfirewalleddomain.local';
- Revoke all privileges on my_db for user myuser on server myfirewalleddomain.local :
revoke ALL PRIVILEGES ON `my_db`.* FROM 'myuser'@'myfirewalleddomain.local';
- Grant access for SELECT on my_db for user myuser on server myfirewalleddomain.local with a password:
GRANT SELECT ON `my_db`.* TO 'myuser'@'myfirewalleddomain.local' IDENTIFIED BY 'mYsupErs3curePassw0Rd' WITH GRANT OPTION;
- Grant all privileges on my_db for user myuser on server myfirewalleddomain.local with a password:
GRANT ALL PRIVILEGES ON `my_db`.* TO 'myuser'@'myfirewalleddomain.local' IDENTIFIED BY 'mYsupErs3curePassw0Rd' WITH GRANT OPTION;