1,创建用户及赋权
-- 创建用户
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';-- 赋予所有权限
GRANT ALL PRIVILEGES ON database_name.* TO 'username'@'localhost';-- 赋予特定表的某些权限
GRANT SELECT, INSERT ON table_name TO 'username'@'localhost';-- 更改密码
ALTER USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new_password';-- 删除用户
DROP USER 'username'@'localhost';--查看用户权限
SHOW GRANTS FOR 'username'@'localhost';--查看用户创建语句
SHOW GRANTS FOR 'username'@'localhost';