kv79 Posted April 2, 2008 Share Posted April 2, 2008 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 More sharing options...
justsomeguy Posted April 2, 2008 Share Posted April 2, 2008 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 More sharing options...
Lulzim Posted April 2, 2008 Share Posted April 2, 2008 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 More sharing options...
kv79 Posted April 3, 2008 Author Share Posted April 3, 2008 -> 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 More sharing options...
Lulzim Posted April 3, 2008 Share Posted April 3, 2008 -> 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 More sharing options...
kv79 Posted April 3, 2008 Author Share Posted April 3, 2008 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 More sharing options...
Lulzim Posted April 3, 2008 Share Posted April 3, 2008 or I can't find it .if you are using windows, it is located on mysql_installation_directory/bin/mysql.exein linux/unix just type mysql Link to comment Share on other sites More sharing options...
kv79 Posted April 3, 2008 Author Share Posted April 3, 2008 I am in windows xp Why do you think that MySQLGrtShell.exe and mysql.exe same thing ? Link to comment Share on other sites More sharing options...
Lulzim Posted April 3, 2008 Share Posted April 3, 2008 I am in windows xp Why do you think that MySQLGrtShell.exe and mysql.exe same thing ?I don't think so, i never said it. In fact i never heard of that mysqlgrt.... thing Link to comment Share on other sites More sharing options...
kv79 Posted April 3, 2008 Author Share Posted April 3, 2008 http://dev.mysql.com/doc/refman/5.0/en/user-names.htmlclick on this link and look at examples you should see that they in way shell> mysql --user=monty --password db_name Link to comment Share on other sites More sharing options...
Lulzim Posted April 3, 2008 Share Posted April 3, 2008 http://dev.mysql.com/doc/refman/5.0/en/user-names.htmlclick on this link and look at examples you should see that they in way shell> mysql --user=monty --password db_namethat is what i was talking aboutso where did you see that MySQLGrtShell in that manual??? Link to comment Share on other sites More sharing options...
kv79 Posted April 3, 2008 Author Share Posted April 3, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.