-
Show grants (access) for a user (SO):
/* How you logged in */
select user();
/* How you actually connected */
select current_user();
show grants for henry;
+--------------------------------------------------------------------+
| Grants for henry@% |
+--------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'henry'@'%' IDENTIFIED BY PASSWORD <secret> |
| GRANT SELECT, INSERT, UPDATE, DELETE ON `henryee`.* TO 'henry'@'%' |
| GRANT ALL PRIVILEGES ON `mysql`.`henryee` TO 'henry'@'%' |
+--------------------------------------------------------------------+Grant access to a user (including for them to be able to grant similar access to others):
GRANT ALL PRIVILEGES ON *.* TO 'tm_dba'@'%' IDENTIFIED BY 'mysql_dba' with grant option;Show which tables, indexes, etc. will be used in a query.
explain delete from mytable where timestamp < 1000000Show a table's structure and indexes:
describe mytable