mysql用户权限操作

Posted 游必有方

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql用户权限操作相关的知识,希望对你有一定的参考价值。

mysql用户权限操作
1.创建用户
mysql -uroot
create database zabbix default charset utf8;
grant all on zabbix.* to [email protected] identified by ‘zabbix‘;
#查看权限
show grants for [email protected];
use mysql;
select * from user where User=‘zabbix‘\G
select Host,User from user where User=‘zabbix‘;


2.设置密码
3.更改权限

#创建user4用户,并授权和配置密码
GRANT SELECT,INSERT ON d3307.* TO [email protected]‘192.168.52‘ IDENTIFIED BY ‘user0523‘;
#查看用户的对应权限
SELECT * FROM mysql.`db` where user=‘user4‘\G


#CREATE创建用户
create user ‘aaa01‘@‘localhost‘ identified by ‘aaa01‘,‘bbb01‘@‘localhost‘ identified by ‘bbb01‘;
#INSERT创建用户
INSERT INTO mysql.user(Host,User,Password,ssl_cipher,x509_issuer,x509_subject) VALUES(‘%’,’newuser1’,PASSWORD(‘123456’),”,”,”);
FLUSH PRIVILEGES;
#GRANT创建用户
grant select,insert on db01.* to ‘aaa02‘@‘localhost‘ identified by ‘aaa02‘;

#DROP删除用户
drop user ‘aaa01‘@‘localhost‘;
#DELETE删除用户
DELETE FROM mysql.user WHERE Host = ‘%’ AND User = ‘admin’;

























以上是关于mysql用户权限操作的主要内容,如果未能解决你的问题,请参考以下文章

mysql权限操作

mysql权限操作

mysql用户操作和权限管理

MySQL用户权限操作

mysql-用户权限管理

MySQL用户创建登录等(超详细)