MySQL数据库权限操作

操作对象:

线上和测试所有MySQL Plus数据库

创新互联公司是一家专业提供唐山企业网站建设,专注与网站设计制作、做网站、HTML5、小程序制作等业务。10年已为唐山众多企业、政府机构等服务。创新互联专业网站设计公司优惠进行中。

创建用户:

create user 'testname'@'%' identified by '123456';

查看testname用户的权限

show grants for testname;

testname用户授权:

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX,ALTER,SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON *.* TO 'testnam'@'%';

#创建用户并授权

GRANT ALL PRIVILEGES ON *.* TO 'testname'@'%'IDENTIFIED BY '123456' WITH GRANT OPTION;

testname用户原有权限:

SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX,ALTER,SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER

查看用户的授权权限:

select * from mysql.user where User='testname' and Host='%'\G;

修改用户的授权权限:

update mysql.user set Grant_priv='Y' where User='testname' and Host='%';

flush privileges;

回收权限:

CREATE,DROP,ALTER

revoke CREATE,DROP,ALTER on *.* from testname@'%';

线上授权testname1:

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON *.* TO 'testname1'@'%';

mysqladmin -u testname1 -h2.1.1.1 password C123456 "c123456"

修改密码:

set password = password 'C123456';

当前题目:MySQL数据库权限操作
URL地址:http://hxwzsj.com/article/ihecep.html

其他资讯

Copyright © 2025 青羊区翔捷宏鑫字牌设计制作工作室(个体工商户) All Rights Reserved 蜀ICP备2025123194号-14
友情链接: 成都定制网站建设 成都网站设计公司 重庆企业网站建设 成都营销网站建设 营销网站建设 重庆网站建设 重庆网站设计 品牌网站建设 专业网站建设 网站建设改版 网站建设方案 成都企业网站设计 网站建设推广 定制级高端网站建设 网站制作 成都网站建设 成都h5网站建设 成都企业网站制作 攀枝花网站设计 外贸营销网站建设 网站建设方案 外贸网站设计方案