我在朋友之间设置了共享的Web服务器。每个网站都有自己的数据库。我希望能够将每个数据库的用户管理委派给数据库的所有者。这样他们就可以为他们的Web应用程序创建帐户来访问他们的特定表,但如果特定应用程序被泄露,他们就不会四处闲逛。
为了进一步说明,我想要这样的事情:
Database server at : db.hosting.coop
db root user : root@db.hosting.coop <full permissions as root>
website and database 1: foo.com
foo.com db user : foo@db.hosting.coop <full permissions on database foo, with ability to grant user access to database foo, granted by root@db.hosting.coop>
foo.coms rails app db user : foorails@localhost <select,insert,update,delete on foo.*, granted by foo@db.hosting.coop>
website and database 2: bar.com
bar.com db user : bar@% <full permissions on database foo, with grant, granted by root@db.hosting.coop>
bar.coms php app db user : bar_website@localhost <select,insert,update,delete on bar.*, granted by bar@db.hosting.coop>
答案 0 :(得分:1)
以root身份:
GRANT CREATE USER ON *.* TO 'foo'@'%';
GRANT ALL PRIVILEGES ON `foo.com`.* TO 'foo'@'%' WITH GRANT OPTION;
如foo:
CREATE USER 'foorails'@'%' IDENTIFIED BY 'secret';
GRANT SELECT ON `foo.com`.* TO 'foorails'@'%'
与其他人一样