1. 程式人生 > >mysql用戶權限操作

mysql用戶權限操作

har 刪除 x509 set fault bbb subject bject utf

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用戶權限操作