您的位置:首页 > 博客中心 > 数据库 >

MySql用户创建、授权以及删除

时间:2022-03-10 18:17

The create user command:

<!---->mysql> CREATE USER yy IDENTIFIED BY ‘123‘;

yy表示你要建立的用户名,后面的123表示密码

上面建立的用户可以在任何地方登陆。

如果要限制在固定地址登陆,比如localhost 登陆:

<!---->mysql> CREATE USER   IDENTIFIED BY ‘123‘;


grant:

<!---->mysql> GRANT ALL PRIVILEGES ON *.* TO ;@localhost

 

<!---->grant select,insert,update,delete on *.* to test1@"%" Identified by "abc";

grant select,insert,update,delete on *.* to test1@"%" Identified by "abc";

格式:grant select on 数据库.* to 用户名@登录主机 identified by "密码"

在这里%代表所有的主机(在mysql中%代表所有,比如“张%”:就代表姓张的所有人)

 

 

修改密码:

 

<!---->mysql> grant   all   privileges   on   pureftpd.*   to   koko@localhost   identified   by   ‘mimi‘;  



flush:

<!---->mysql> flush privileges;

 

 

查看用户信息:

<!---->mysql> select host,user from mysql.user; 


MySql用户创建、授权以及删除,布布扣,bubuko.com

热门排行

今日推荐

热门手游