日期:2014-05-16  浏览次数:20695 次

postgresql 用户权限问题
数据库一个[testdb]
用户三个
testdb_admin 可以创建、修改和删除testdb里的表
testdb_writer 可以对testdb里的每个表执行查询、插入、删除、更新操作,但不能创建和删除表
testdb_reader 可以对testdb里的表进行查询,但不能修改表里的行

这个应该怎么做?

------解决方案--------------------
如果是mysql

1
grant create,update,delete on testdb.* to testdb_admin@'%' identified by 'yourpassword';
2
grant select,insert,update,delete on testdb.* to testdb_writer@'%' identified by 'yourpassword';
3
grant select testdb.* to testdb_writer@'%' identified by 'yourpassword';
------解决方案--------------------
1、grant create,update,delete on testdb.*to testdb_admin@'%'identity by 'newpassword';
2、grant select,insert,update,delete on testdb.* to testdb_wirte@'%' identity by 'newpassword';
3、grant testdb.*to testdb_writer@'%;' identity by 'newpassword';