This topic lists some of the commonly used SQL statements.

For more information about the SQL statements including parameters and restrictions, see MySQL 5.7 Reference Manual.

Database-related SQL statements

Operation Example
Create a database and designate a character set.
create database db01 DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci;
Delete a database.
drop database db01;

Account-related SQL statementss

Note If an RDS instance has a premier account, the passwords of the other accounts under this instance cannot be changed by using the premier account. To change the password of another account, you must delete this account and create a new one.
Operation Example
Create an account.
CREATE USER 'username'@'host' IDENTIFIED BY 'password';
Delete an account.
DROP USER 'username'@'host';
Authorize the account.
GRANT SELECT ON db01. * TO 'username'@'host';
Query the created accounts in the database.
SELECT user,host,password FROM mysql.user_view;
or
show grants for xxx
Reclaim permissions.
  • Reclaim all permissions:
    REVOKE ALL PRIVILEGES,GRANT OPTION FROM 'username'@'host';
  • Reclaim specific permissions:
    REVOKE UPDATE ON *. * FROM 'username'@'host';