Mysql指定用户和设置用户访问表权限

1:创建用户

create user 'username'@'%' identified by 'password';

例:create user 'test_security'@'%' identified by '123456';

2:设置权限

GRANT privilege ON dbname.tablename TO 'username'@'%' IDENTIFIED BY "password";

例:grant all on test_security.* to 'test_security'@'%' identified by '123456';

3:刷新权限

flush privileges;

 4:查看用户权限

show grants for 'test_security'@'%';

 

posted @ 2022-12-23 13:39  鸭猪是的念来过倒  阅读(138)  评论(0编辑  收藏  举报