hello,
first thanks to ViSolve DB Team,
and since then, my question turns out to be :
in the base that contains a table of 100 columns, I want to disable SELECT
on only 1 column "hide_this",
how to apply column privileges using a loop in mysql, that could do :
____
for each column in the_base.t100 where column_name is NOT hide_this
do
 GRANT SELECT(column_name_n) ON the_base.t100 to 'a_user'@'localhost'
      identified by 'a_passwd';
done ----

Or should I build a script to create sql commands for that ?

thanks,




You have applied TABLE level GRANT PRIVILEGES and tried to REVOKE that with COLUMN PRIVILEGES. Hence the error.

To Fix it, apply column privileges  ---

mysql> GRANT SELECT(hide_this) ON the_base.t100 to 'a_user'@'localhost' identified by 'a_passwd';

mysql> select * from information_schema.column_privileges;

mysql> REVOKE SELECT(hide_this) ON the_base.t100 from 'a_user'@'localhost' identified by 'a_passwd';

Note:  Always TABLE PRIVILEGES override COLUMN PRIVILEGES


Thanks
ViSolve DB Team

----- Original Message ----- From: "Gilles MISSONNIER" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
Sent: Tuesday, February 06, 2007 11:05 PM
Subject: revoke SELECT on a column [ MySQL 4.1 ]


Hello,
In a table [say t100], having 100 columns,
I want to allow the select on all columns but 1.

I tried to do this by granting all columns in the table t100, of the base,
then revoke SELECT on the column "hide_this",
but this doesn't work.


mysql> GRANT SELECT ON the_base.t100 to 'a_user'@'localhost'
identified by 'a_passwd';

mysql>  revoke SELECT (hide_this) on the_base.t100 from
'a_user'@'localhost';
ERROR 1147 (42000): There is no such grant defined for user 'a_user' on
host 'localhost' on table 'current'


Is there a turn around, or should grant the select on the 99 other columns

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to