例2、 增加一个用户test2密码为abc,让他只可以在localhost上登录,并可以对数据库mydb进行查询、插入、修改、删除的操作 (localhost指本地主机,即MYSQL数据库所在的那台主机),这样用户即使用知道test2的密码,他也无法从internet上直接访问数据 库,只能通过MYSQL主机上的web页来访问了。
grant select,insert,update,delete on mydb.* to “test2”@localhost identified by "abc";
如果你不想test2有密码,可以再打一个命令将密码消掉。
grant select,insert,update,delete on mydb.* to “test2”@localhost identified by "";
grant select,insert,update,delete on dez.* to “test2”@"%" identified by "123456";







