创建仅能访问一个数据库的用户

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

CREATE USER 'username'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON `database` . * TO 'username'@'%';
FLUSH PRIVILEGES;