创建数据库

CREATE DATABASE finance CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

创建用户

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
CREATE USER 'username'@'%' IDENTIFIED BY 'password';

更改用户权限

GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;

取消用户权限

REVOKE ALL PRIVILEGES ON *.* FROM 'username'@'localhost';
REVOKE ALL PRIVILEGES ON *.* FROM 'username'@'%';

刷新权限

FLUSH PRIVILEGES;