6 messages in com.mysql.lists.mysqlonly 1 entry per user in user table?| From | Sent On | Attachments |
|---|---|---|
| Rusty Wright | 10 Apr 2001 16:11 | |
| Jason Brooke | 10 Apr 2001 16:42 | |
| Rusty Wright | 10 Apr 2001 16:57 | |
| Rusty Wright | 10 Apr 2001 17:01 | |
| Rusty Wright | 10 Apr 2001 17:12 | |
| Rusty Wright | 10 Apr 2001 17:22 |
| Subject: | only 1 entry per user in user table?![]() |
|---|---|
| From: | Rusty Wright (rus...@socrates.Berkeley.EDU) |
| Date: | 04/10/2001 04:11:07 PM |
| List: | com.mysql.lists.mysql |
I'm trying to set it up so that I have only 1 entry per user in my mysql user table. My users will have the same privileges regardless of what host they come in from. There's only 1 database they'll be working with. There are 2 users, user "dentry" can add and edit information in the database named "mydb" and user "dbuser" can only look at information in the database.
The following setup works. What I don't like about it is that I had to add a entries to the mysql user table for localhost so that they can connect locally as well as remotely. Ordinarily it will be localhost connections (via php).
Notice that I'm using blank or empty values for the host in the mysql user table as well as the mysql db table so that the mysql host table is what controls where they can connect from.
In order to avoid having 2 entries in the user table, can I have just 1 entry and use the % wildcard for the host? Then use the empty host in the db table and let the host table control what hosts they come in from?
# data entry user; can edit and add to database. insert into user (Host, User, Password) values('', 'dentry', password('pw1')); insert into user (Host, User, Password) values('localhost', 'dentry', password('pw1')); # user of the database; can only do selects. insert into user (Host, User, Password) values('', 'dbuser', password('pw2')); insert into user (Host, User, Password) values('localhost', 'dbuser', password('pw2'));
insert into db (Host, Db, User, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv) values('', 'mydb', 'dentry', 'y', 'y', 'y', 'y', 'y'); insert into db (Host, Db, User, Select_priv) values('', 'mydb', 'dbuser', 'y');
insert into host (Host, Db, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv) values('host1', 'mydb', 'y', 'y', 'y', 'y', 'y'); insert into host (Host, Db, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv) values('host2', 'mydb', 'y', 'y', 'y', 'y', 'y'); insert into host (Host, Db, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv) values('localhost', 'mydb', 'y', 'y', 'y', 'y', 'y');
flush privileges;




