====== MySQL 添加/删除用户及修改用户权限 ====== mysql -p -u root CREATE USER 'user'@'localhost' IDENTIFIED BY 'password'; CREATE DATABASE DBNAME; GRANT ALL PRIVILEGES ON database.table TO 'user'@'localhost'; GRANT ALL PRIVILEGES ON database.* TO 'user'@'localhost'; GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost'; GRANT SELECT, INSERT, DELETE ON database.* TO 'user'@'localhost'; FLUSH PRIVILEGES; DROP USER 'user'@'localhost' ===== Reference ===== * https://kyup.com/tutorials/create-new-user-grant-permissions-mysql/