Skip to content

Instantly share code, notes, and snippets.

@wwalker
Created January 4, 2016 00:24
Show Gist options
  • Save wwalker/26abee5834d23882b34e to your computer and use it in GitHub Desktop.
Save wwalker/26abee5834d23882b34e to your computer and use it in GitHub Desktop.
mysql.grants
mysql> show grants for powerdns;
ERROR 1141 (42000): There is no such grant defined for user 'powerdns' on host '%'
mysql> GRANT SELECT on powerdns.* TO [email protected];
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-mailer.com' at line 1
mysql> GRANT SELECT on powerdns.* TO powerdns@'luke.ex-mailer.com';
Query OK, 0 rows affected (0.00 sec)
mysql> show grants for powerdns;
ERROR 1141 (42000): There is no such grant defined for user 'powerdns' on host '%'
mysql> create user powerdns@'%' identified by 'asdlfkjalsdfjiqaw4m3oalimsdvlakwejr;lkj';
Query OK, 0 rows affected (0.01 sec)
mysql> show grants for powerdns;
+---------------------------------------------------------------------------------------------------------+
| Grants for powerdns@% |
+---------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'powerdns'@'%' IDENTIFIED BY PASSWORD '*FD44D825695F881A44821FE9648095FA8A3DC62F' |
+---------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> GRANT SELECT on powerdns.* TO powerdns@'luke.ex-mailer.com';
Query OK, 0 rows affected (0.00 sec)
mysql> show grants for powerdns;
+---------------------------------------------------------------------------------------------------------+
| Grants for powerdns@% |
+---------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'powerdns'@'%' IDENTIFIED BY PASSWORD '*FD44D825695F881A44821FE9648095FA8A3DC62F' |
+---------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> GRANT ALL on powerdns.* TO powerdns@'yoda.ex-mailer.com';
Query OK, 0 rows affected (0.01 sec)
mysql> show grants for powerdns;
+---------------------------------------------------------------------------------------------------------+
| Grants for powerdns@% |
+---------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'powerdns'@'%' IDENTIFIED BY PASSWORD '*FD44D825695F881A44821FE9648095FA8A3DC62F' |
+---------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> show grants for powerdns@'luke.ex-mailer.com';;
+-----------------------------------------------------------------+
| Grants for [email protected] |
+-----------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'powerdns'@'luke.ex-mailer.com' |
| GRANT SELECT ON `powerdns`.* TO 'powerdns'@'luke.ex-mailer.com' |
+-----------------------------------------------------------------+
2 rows in set (0.00 sec)
ERROR:
No query specified
mysql> show grants for powerdns@'yoda.ex-mailer.com';;
+-------------------------------------------------------------------------+
| Grants for [email protected] |
+-------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'powerdns'@'yoda.ex-mailer.com' |
| GRANT ALL PRIVILEGES ON `powerdns`.* TO 'powerdns'@'yoda.ex-mailer.com' |
+-------------------------------------------------------------------------+
2 rows in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment