IT科技

一文总结MySQL数据库访问控制实现原理

字号+作者:益华科技来源:人工智能2025-11-05 08:21:54我要评论(0)

复制//针对root账号 setglobalvalidate_password_policy=0;--设置判断密码的标准基于密码的长度validate_password_leng

一文总结MySQL数据库访问控制实现原理
复制//针对root账号  set global validate_password_policy=0; --设置判断密码的文总问控标准基于密码的长度(validate_password_length)  grant all privilges on *.* to root@localhost identified by password;  grant all privilges on *.* to root@% identified by password; --根据具体情况决定是网站模板否开启  //针对日常运维账号  grant select, insert, update, delete on database_name.* to hwb@% identified by password;  grant create,alter,drop,references on database_name.* to hwb@%;   grant create temporary tables on database_name.* to hwb@%;   grant index on database_name.* to hwb@%;   grant create view on database_name.* to hwb@%;   grant show view on database_name.* to hwb@%;   grant create routine on database_name.* to hwb@%; -- 查看存储过程、函数状态   grant alter routine on database_name.* to hwb@%; --删除存储过程、站群服务器数据函数  grant execute on database_name.* to hwb@%;  grant all privileges on mysql.* to hwb@% identified by password; --不增加不能对其他用户的库访函数或存储过程做操作  //针对应用连接账号  grant all privileges on database_name.* to hwb2@应用服务器IP identified by password;  grant all privileges on mysql.* to hwb2@应用服务器IP; --不增加无法对其他用户的源码库函数或存储过程做操作  //针对只读账号(导出数据库权限)  grant select on database_name.* to hwbread@% identified by hwbread123;  grant select on mysql.* to hwbread@%;  grant show view on database_name.* to hwbread@%;  grant file on *.* to hwbread@%; --if database_name.* will ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES  1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • 电脑蓝屏错误时间的解决方法(提高电脑稳定性,有效应对蓝屏错误)

    电脑蓝屏错误时间的解决方法(提高电脑稳定性,有效应对蓝屏错误)

    2025-11-05 07:43

  • 面对域名投资需要知晓什么?域名投资有什么看法?

    面对域名投资需要知晓什么?域名投资有什么看法?

    2025-11-05 06:19

  • cn域名怎么玩的?个人注册cn域名有什么要求?

    cn域名怎么玩的?个人注册cn域名有什么要求?

    2025-11-05 06:14

  • 注册域名要做到哪几点?小白域名注册要注意什么?

    注册域名要做到哪几点?小白域名注册要注意什么?

    2025-11-05 05:35

网友点评