Mammouth du PHP |
19672 Messages
05 juin 2006, 09:39
As-tu essayé d'ajouter tes utilisateurs via la ligne de commande MySQL plutôt qu'avec phpMyAdmin ?
Je viens de procéder à quelques essais, j'ai créé un schéma et un utilisateur n'ayant de droits que sur ce schéma. En me loggant sous ce pseudo, j'accède au schéma créée plus information_schema, mais ce dernier est en lecture seule, je ne peux y apporter aucune modifications.
Voici ce que j'ai fait, d'abord en root:
-1- création du schéma :
-2- Création de l'utilisateur :
Code : Tout sélectionner
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
ON betatest.*
to betatest@localhost
identified by 'abcd';
Ensuite, j'ai fermé ça et j'ai ouvert une nouvelle ligne de commande en me loggant sous le pseudo créé "betatest" :
Code : Tout sélectionner
C:\>mysql -u betatest -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 741 to server version: 5.0.21-community-nt-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| betatest |
+--------------------+
2 rows in set (0.00 sec)
Effectivement, je vois bien le schéma créé pour cet utilisateur et information_schema, mais regarde maintenant ceci:
Code : Tout sélectionner
mysql> CREATE SCHEMA `testbeta`;
ERROR 1044 (42000): Access denied for user 'betatest'@'localhost' to database 'testbeta'
mysql> SELECT * FROM SCHEMA_PRIVILEGES;
+------------------------+---------------+--------------+----------------+--------------+
| GRANTEE | TABLE_CATALOG | TABLE_SCHEMA | PRIVILEGE_TYPE | IS_GRANTABLE |
+------------------------+---------------+--------------+----------------+--------------+
| 'betatest'@'localhost' | NULL | betatest | SELECT | NO |
| 'betatest'@'localhost' | NULL | betatest | INSERT | NO |
| 'betatest'@'localhost' | NULL | betatest | UPDATE | NO |
| 'betatest'@'localhost' | NULL | betatest | DELETE | NO |
| 'betatest'@'localhost' | NULL | betatest | CREATE | NO |
| 'betatest'@'localhost' | NULL | betatest | DROP | NO |
+------------------------+---------------+--------------+----------------+--------------+
6 rows in set (0.00 sec)
mysql> UPDATE SCHEMA_PRIVILEGES
-> SET IS_GRANTABLE = 'YES'
-> WHERE PRIVILEGE_TYPE = 'DROP';
ERROR 1044 (42000): Access denied for user 'betatest'@'localhost' to database 'information_schema'
Je vois information_schema, mais je ne peux rien y modifier.
En revanche, en utilisant la base betatest, l'accès est normal :
Code : Tout sélectionner
mysql> USE `betatest`;
Database changed
mysql> CREATE TABLE `test`(
-> test_id INT(11) NOT NULL AUTO_INCREMENT,
-> test_txt CHAR(64) NOT NULL,
-> PRIMARY KEY(test_id)
-> )ENGINE=MyISAM;
Query OK, 0 rows affected (0.05 sec)
Modifié en dernier par
Cyrano le 05 juin 2006, 22:31, modifié 1 fois.
Codez en pensant que celui qui maintiendra votre code est un psychopathe qui connait votre adresse 