Home  >  Article  >  Database  >  Mysql新建用户、用户授权_MySQL

Mysql新建用户、用户授权_MySQL

WBOY
WBOYOriginal
2016-06-01 13:07:181033browse

1:用root用户登录mysql数据库


2:使用授权的方式新建用户


GRANT USAGE ON zentao.* TO 'zenuser'@'%' IDENTIFIED BY 'zenadmin' WITH GRANT OPTION;

其中zentao表示库名,*表示当前库下所有表,zenuser表示用户名,%表示任意地方登录,为限制IP,zenadmin表示密码。

3:为用户添加相应权限


grant select,insert,update,delete,drop on zentao.* to 'zenuser'@'%' identified by "zenadmin";

给用户所有权限:

grant all privileges on zentao.* to 'zenuser'@'%'   identified by 'zenadmin' with grant option;

给用户添加相应的操作权限。

4:保存权限


5:此时在客户端用你新建的用户登录可能仍然无法登录,需要执行如下操作才可以。


目的为删除匿名用户

5:测试结果


OK,结束。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn