MySQL Permissions

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
Todd_Z
Forum Regular
Posts: 708
Joined: Thu Nov 25, 2004 9:53 pm
Location: U Michigan

MySQL Permissions

Post by Todd_Z »

Code: Select all

grant select (field,id), update (field) on db.table to user@localhost;
I thought that this would give read permission on field and id for user on the database db, also with update privilege to field.

However, when I login as user@localhost, and do a select * from db.table, it shows the whole table's data.

Any ideas?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

That I remember, the restrictions only go to the table level of granularity. If you need more, break them into separate tables. :?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

You can assign permissions to a field level. I have absolutely no clue what the SQL is for that, but I know it can be done. Maybe do it in PMA or SQLYog an see what the resultant SQL is.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

However, when I login as user@localhost, and do a select * from db.table, it shows the whole table's data.
Does SELECT User() confirm you're using the right account?
With an account with sufficient privileges try SHOW GRANTS FOR 'user'@'localhost'. What does it return?
Post Reply