Skip to content

Latest commit

 

History

History
51 lines (36 loc) · 1.53 KB

File metadata and controls

51 lines (36 loc) · 1.53 KB

MySQL

API

/* 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;

Explain

Show which tables, indexes, etc. will be used in a query.

explain delete from mytable where timestamp < 1000000

Describe

Show a table's structure and indexes:

describe mytable