标签:mysql
本机访问权限:
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘username‘@‘localhost‘ IDENTIFIED BY ‘password‘;
远程访问权限:
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘username‘@‘%‘ IDENTIFIED BY ‘password‘;
FLUSH PRIVILEGES;
增加用户 test1 密码 abc,让它可以在任何主机上登录,并对所有数据库有查询,插入,修改,删除的权限:
格式: grant select on 数据库.* to 用户名@登录主机 identified by "密码"
grant select,insert,update,delete on *.* to test1@"%" Identified by "abc";
删除用户
drop user root@localhost;(@不加默认为“%”)
权限回收
revoke delete on test.* from admin@‘localhost‘;
授权精确到列
grant select (cur_url,pre_url) on dataname.table_name to admin@localhost;
限制用户资源
mysql> GRANT ALL ON customer.* TO ‘francis‘@‘localhost‘
-> IDENTIFIED BY ‘frank‘
-> WITH MAX_QUERIES_PER_HOUR 20
-> MAX_UPDATES_PER_HOUR 10
-> MAX_CONNECTIONS_PER_HOUR 5
-> MAX_USER_CONNECTIONS 2;
本文出自 “比尔运维笔记” 博客,请务必保留此出处http://chenshoubiao.blog.51cto.com/6159058/1842667
标签:mysql
原文地址:http://chenshoubiao.blog.51cto.com/6159058/1842667