Jump to content

privileges of table in database


kv79

Recommended Posts

Hi all,I want to set a user privileges to table of database .example .I have a database database have 2 tables both tables can use Admins only one table can use UsersThanks advance .

Link to comment
Share on other sites

Are you talking about MySQL users? Like if someone connects to the database with a certain username and password they can modify both tables, but if they connect with another username and password they can only modify one of them?

Link to comment
Share on other sites

If you are trying to do what justsomeguy said here is a way:run these queries on mysql console or phpmyadminLets say the user that has access to both tables is admin, and the user with access to only one table is limiteduserif you haven't created users yet use this:

GRANT ALL PRIVILEGES ON databasename.* TO 'admin'@'localhost' IDENTIFIED BY 'password_for_admin' WITH GRANT OPTION;GRANT ALL PRIVILEGES ON databasename.tablename TO 'limiteduser'@'localhost' IDENTIFIED BY 'password_for_limiteduser';FLUSH PRIVILEGES;

if you have created users before and just want to give proper privileges, use this:

GRANT ALL PRIVILEGES ON databasename.* TO 'admin'@'localhost' WITH GRANT OPTION ; /* grant all privileges to admin user */REVOKE ALL PRIVILEGES ON databasename.* FROM 'limiteduser'@'localhost'; /* remove all privileges if there is any*/GRANT ALL PRIVILEGES ON databasename.tablename TO 'limiteduser'@'localhost'; /* now grant the privileges only to one table */FLUSH PRIVILEGES; /* after modifying privileges you need to reload them */

If you don't want to give all privileges, you can use grant insert, update, delete, drop, alter ...read more @ mysql user account managementif this seems too complicated, you can do it with clicks using phpmyadmin

Link to comment
Share on other sites

-> justsomeguy Are you talking about MySQL users? Like if someone connects to the database with a certain username and password they can modify both tables, but if they connect with another username and password they can only modify one of them?I know how do that for mysql-> Lulzim I did it with phpmyadmin.But you code have nothing with mysql and command line . As I see. You should check link you gave to me because there is the reference for mysql .Your link is useful http://dev.mysql.com/doc/refman/5.0/en/use...management.html

Link to comment
Share on other sites

-> Lulzim I did it with phpmyadmin.But you code have nothing with mysql and command line . As I see. You should check link you gave to me because there is the reference for mysql .
what do you mean by you code has nothing to do with mysql and command line?????even if you give the permissions using phpmyadmin you will see something similar to these queries being executed.and if you don't know, there is a mysql command line tool that you can use
Link to comment
Share on other sites

To do that you will need first to connect to database because in Administrator modethis to open shell and this file does not exist any more MySQLGrtShell.exeor I can't find it .

Link to comment
Share on other sites

I used you link , and in search tag I typed "shell" and then he show me a lot of document with word shell and I found a shell file with name MySQLGrtShell.exe and it was a just a name(http://dev.mysql.com/doc/workbench/en/invoking-grt-from-command-line.html) , so i search to download it and it is really heavy to find it or they pull back from download section .ftp://ftp.mysql.com/pub/mysql/download and or I do not have a privileges to download or they do not like us .If they do now allow us to download a free software , there is a some window called "beta window" (or this is a legend ) , and you just type there IP address and you can add or remover files by you wishes .

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...