| mysql | Allows user to connect to the MySQL CLI |
>MYSQL -U [USERNAME] -P; |
| exit | Exits the MySQL CLI |
>EXIT; |
| clear | Clears the MySQL shell |
>SYSTEM CLEAR; |
| create user | Creates a new user |
>CREATE USER `NEWUSER`@`LOCALHOST` IDENTIFIED BY `NEW_PASSWORD` |
| show user | Shows all user who have access to the MySQL Client |
>SELECT USER, HOST FROM MYSQL.USER; |
| drop user | To delete an existing user |
> DROP USER 'USERNAME'@'LOCALHOST'; |
| grant all privileges | Assigns privileges to a MySQL user |
>GRANT ALL PRIVILEGES ON * . * TO 'USERNAME'@'LOCALHOST'; |
| show grants | Displays the privileges that are assigned to a MySQL user |
> SHOW GRANTS FOR 'USERNAME'@'LOCALHOST'; |
| revoke all privileges | Revokes all privileges assigned to a MySQL user |
>REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'USERNAME'@'LOCALHOST'; |
| mysqldump | Creates a backup of a set of SQL statements that can be used to recreate the original database object definitions and table data. |
>MYSQLDUMP -U USERNAME -P DATABASENAME> DATABASENAME_BACKUP.SQL |