mysql创建用户权限
-
创建用户
MySQL中的用户帐号由用户名,以及使用
@
字符分隔的主机名组成。CREATE user user_account IDENTIFIED BY password; 例: create user super@localhost IDENTIFIED BY '123456'; //localhost主机连接到MySQL数据库服务器 create user super@'%' IDENTIFIED BY '123456'; //允许从任意主机登录, create user super@'abc.com' IDENTIFIED BY '123456'; //abc.com登录 create user super identified by '123456' ;省略了用户帐户的主机名部分,MySQL也会接受它,并允许用户从任何主机进行连接
-
删除用户
drop user super@'%';
-
查看所有用户
select user,host from mysql.user;
-
查看当前用户
select current_user();
-
重命名
rename user super01 to super02;
-
修改密码
alter user super02 identified by '6';
-
添加权限
GRANT All ON scada_db.* TO super02 WITH GRANT OPTION; //WITH GRANT OPTION 该用户能为其他用户授权
-
刷新
flush privileges;
-
其他
//创建用户 CREATE USER super@'%' IDENTIFIED BY '123456'; //查看授权 SHOW GRANTS FOR super@'%'; //赋权 GRANT SELECT, UPDATE, DELETE ON scada_db.* TO super; //创建用户 CREATE USER super01 IDENTIFIED BY '123456'; //授权 GRANT All ON scada_db.* TO super01 WITH GRANT OPTION; //查看用户授权 SHOW GRANTS FOR super01; //删除用户 drop user super@'%'; //查看所有用户 select user,host from mysql.user; //查看当前用户 select current_user(); //重命名 rename user super01 to super02; //修改密码 alter user super02 identified by '6';
标签:权限,GRANT,用户,IDENTIFIED,user,mysql,123456,super From: https://www.cnblogs.com/lqh969696/p/17751910.html