Last active
July 6, 2018 07:41
-
-
Save appkr/63ffd390fb7de16d804835ed438ca57c to your computer and use it in GitHub Desktop.
Add a database user
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- as master user | |
| CREATE USER 'TICKET'@'%' IDENTIFIED BY '************'; | |
| GRANT SELECT ON `prime`.`table` TO 'TICKET'@'%'; | |
| GRANT INSERT, UPDATE ON TABLE `prime`.`table` TO 'TICKET'@'%'; | |
| FLUSH PRIVILEGES; | |
| -- as TICKET user | |
| -- DO SOME DANGEROUS JOB | |
| -- as master user | |
| DROP USER 'TICKET'@'%'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- @ root user session | |
| CREATE USER 'monitoring'@'%' IDENTIFIED BY '**'; | |
| GRANT PROCESS ON *.* TO 'monitoring'@'%'; | |
| GRANT SELECT ON `performance_schema`.* TO 'monitoring'@'%'; | |
| FLUSH PRIVILEGES; | |
| SHOW GRANTS FOR 'monitoring'@'%'; | |
| -- @ monitoring user session | |
| SHOW FULL PROCESSLIST; | |
| KILL /*PID*/; | |
| -- RDS stored_procedure | |
| CALL mysql.rds_kill(/*PID*/); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment