Mysql 快速创建账号并授权只读权限


创建账号

本地访问:

create user username@localhost identified by 'password';

外网访问:

create user 'username'@'%' identified by 'password';
flush privileges;
账号授权database_name数据库所有权限
grant all privileges on `database_name`.* to 'username'@'%' identified by 'password';
flush privileges;
只读权限
grant select on database1.* to 'username'@'%' identified by 'password';
grant select on database2.* to 'username'@'%' identified by 'password';
flush privileges;
-- select 查询权限,all privileges 所有权限或指定select,delete,update,create,drop权限
-- database1 数据库
-- username 用户账号
-- password 密码
-- % 所有电脑可访问


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM