tags:

views:

29

answers:

1

Hi all, In mySql, as far as my understanding goes, its possible for us to grant privileges for same user name from different hosts. eg. user 'karthick' @ localhost could be assigned privileges different from user 'karthick' @ madhost.com

But, will it be possible to connect to a database with same user name and from same host but with different privileges? For eg. like fopen("file.txt","r") & fopen("file.txt","w"); will we be able to connect to database from the same host with the same username but different privileges?

A: 

To my knowledge, you can assign different privileges for the same user, but not on to the same database on the server. If you could, the server would not know which set of permissions to use. If it is on a different server, it will just be a new user which has the same username and password. They won't be linked in any other way.

Surim
Ok.. In that Case, will we be able to open multiple connections each with a different set of privileges with the same user name and from the same host?
Karthick
Could you please explain? Im not too sure what you mean
Surim
Karthick
1: This is possible, but not with the same username/password. When you GRANT privileges for a user, you grant them on a per schema bases. This means that a user will either have SELECT only for that schema, or SELECT, INSERT, UPDATE (whatever you define) for that schema. 2: That will work, you will create 2 users. 1st could be JoeREAD which will have SELECT access on the database, then the 2nd would be JoeWRITE which will have access to the INSERT, UPDATE etc. It will have to be 2 users if you are accessing the same schema on the same database server
Surim