MySQL5.7用户权限分配(分配数据库给用户)的时候使用grant all on test.* to 'test@localhost';这个语句显示成功执行,但是没有分配成功。
错误现象:
登录到test用户,不能查看到test数据库。
错误原因:
grant all on test.* to 'test@localhost'; #语法本身没有错,但是'test@localhost'多了单引号或者说单引号位置写少了,造成test数据库没有分配给test用户。
解决方案:
方案1.去掉'test@localhost'中的单引号,改为:grant all on test.* to test@localhost;执行后,flush privileges;登录test用户,发现有了test数据库。
方案2.修改'test@localhost',改为:grant all on test.* to 'test'@'localhost';执行后,flush privileges;登录test用户,发现有了test数据库。
转载请注明:MitNick » MySQL5.7用户权限分配的时候使用grant all on test.* to ‘test@localhost’;这个语句显示成功执行,但是没有分配成功。