Last active
August 27, 2018 06:19
-
-
Save r6m/0e2c0cb407bee88e7b95da0aec9650dd to your computer and use it in GitHub Desktop.
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
-- create user | |
create user user; | |
-- check user | |
select user, host, password from mysql.user; | |
-- set password | |
use mysql; | |
update user set password=PASSWORD("secret") where User='user'; | |
-- grand all privileges | |
GRANT ALL PRIVILEGES ON database.* TO 'user'@'%' IDENTIFIED BY 'secret' WITH GRANT OPTION; | |
flush privileges; | |
-------- other stuff -------- | |
-- to revoke all privileges from a user | |
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user; | |
-- to grand some privileges for specific user and databse | |
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `database`.* TO 'user'@'%' WITH GRANT OPTION |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
remember to
flush privileges