grant 权限名(所有的权限用all) on 库名(*全部).表名(*全部) to '用户名'@'%'(%表示所有的IP,可以只些一个IP) identified by "密码"; 2)授权所有主机: grant all privileges on *.* to 'testUser'@'%' identified by '123456' with grant option; flush privileges;
3)授权指定主机: grant all privileges on *.* to 'testUser'@'192.168.22.250' identified by 'password' with grant option; flush privileges;
4)授权本地主机: grant all privileges on *.* to root@localhost identified by 'password' with grant option; flush privileges;
5)授权指定数据库: grant all privileges on testDB.* to 'testUser'@localhost identified by 'password' with grant option; flush privileges;
6)授权指定操作权限: grant select, insert, update, delete, create, drop on testDB.* to testUser@localhost identified by 'password' with grant option; flush privileges;
7) 进mysql库查看host为%的数据是否添加: use mysql; select host, user, password, Delete_priv, Grant_priv, Execute_priv from user;