Windows中MySQL主从数据库搭建(二)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wangshuxuncom/article/details/79027991

MySQL数据库权限的授予

语法:grant privilege1, privilege2,…privilegen on database_name.table_name touser_name@user_address [identified by 'password'];

privilege1, privilege2,…privilegenprivilege代表selectinsertupdatedeletecreatedropindexaltergrantreferencesreloadshutdownprocessfile14个权限;如果要授予用户所有权限可以all privileges或者all代替;

database_name.table_name:可以简写为*.*,此时表示被授予的用户可以操作当前MySQL软件上的所有数据库的所有表;

user_name@user_address:user_address可以是localhost、ip地址、机器名字、域名,也可以是单引号引起来的%,%表示任意地址;

password:为被授予权限的用户指定密码——如果被授予权限的用户已存在且不修改其密码,则可以省略该部分;如果被授予权限的用户已不存在且省略了该部分,则创建该用户且其密码为空

e.g:

grant all privileges on *.* to jim@localhostidentified by '123';
为本机MySQL数据库jim用户分配可对所有数据库的所有表进行所有操作的权限,并设定登录口令为123

grantall privileges on *.* to [email protected] identified by '123';
IP地址为192.168.40.87的计算机内安装的MySQL数据库jim用户分配可对所有数据库的所有表进行所有操作的权限,并设定登录口令为123

猜你喜欢

转载自blog.csdn.net/wangshuxuncom/article/details/79027991
今日推荐