Adding Accounts, Assigning Privileges, and Dropping Accounts TO ’custom’@’localhost’; CREATE USER ’custom’@’host47.example.com’ IDENTIFIED BY ’ password ’; GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON expenses.* TO ’custom’@’host47.example.com’; CREATE USER ’custom’@’%.example.com’ IDENTIFIED BY ’ password ’; GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON customer.addresses TO ’custom’@’%.example.com’; mysql>  SET print_identified_with_as_hex = ON; mysql>  SHOW CREATE USER ’admin’@’localhost’\G *************************** 1. row *************************** CREATE USER for admin@localhost: CREATE USER ’admin’@’localhost’ IDENTIFIED WITH ’caching_sha2_password’ AS REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD HISTORY DEFAULT PASSWORD REUSE INTERVAL DEFAULT PASSWORD REQUIRE CURRENT DEFAULT Revoke global privileges: To revoke account privileges, use the  REVOKE  statement. Privileges can be revoked at different levels, just as they can be granted at different levels. 1224 Enabling the  print_identified_with_as_hex  system variable (available as of MySQL 8.0.17) causes SHOW CREATE USER  to display hash values that contain unprintable characters as hexadecimal strings rather than as regular string literals. Revoking Account Privileges Checking Account Privileges and Properties The three accounts can be used as follows: •The  ’custom’@’localhost’  account has all database-level privileges to access the  bankaccount database. The account can be used to connect to the server only from the local host. •The  ’custom’@’host47.example.com’  account has specific database-level privileges to access the  expenses  database. The account can be used to connect to the server only from the host host47.example.com . •The  ’custom’@’%.example.com’  account has specific table-level privileges to access the addresses  table in the  customer  database, from any host in the  example.com  domain. The account can be used to connect to the server from all machines in the domain due to use of the  %  wildcard character in the host part of the account name. To see the privileges for an account, use  SHOW GRANTS : mysql>  SHOW GRANTS FOR ’admin’@’localhost’; +-----------------------------------------------------+ | Grants for admin@localhost | +-----------------------------------------------------+ | GRANT RELOAD, PROCESS ON *.* TO ’admin’@’localhost’ | +-----------------------------------------------------+ To see nonprivilege properties for an account, use  SHOW CREATE USER :