Acces securisé au champ d'une table Mysql

nicolas -  
 nicolas -
Salut a tous,

Je debute sous Mysql ... je cherche a faire 2 tables contenants divers champs.
Certain utlisateur auraont acces a tout les champs de la table et d'autres utilisateurs a certains champs ..
Comment faire pour gérer ca ????
Merci et bon appétit,

nicolas
A voir également:

1 réponse

jisisv Messages postés 3678 Statut Modérateur 935
 
Essaye de restructurer ta base de données de sorte que les utilisateurs
(toto et titi) n'accède qu'aux tables dont ils ont besoin pour leur requêtes.
 mysqladmin -u root create bidon
mysql -u root bidon
mysql> create table tabletiti (f1 char(10));
mysql> create table tabletoto (f2 char(10));
mysql> grant all privileges on bidon.tabletoto to toto@localhost identified by 'toto';
mysql>grant all privileges on bidon.tabletiti to titi@localhost identified by 'titi';

Alors
johand@horus:~$ mysql -u toto -ptoto bidon
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 16 to server version: 4.0.21-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select * from tabletiti;
ERROR 1142: select command denied to user: 'toto@localhost' for table 'tabletiti'

Johan
Il faudra évidemment disposer d'un utilisateur ayant le droit de lier les tables sinon , on perd l'utilité d'une BDD relationnelle.
Gates gave you the windows.
GNU gave us the whole house.(Alexandrin)
1
nicolas
 
Merci mille fois ;-)
nicolas
0