MYSQL Suppression et Creation conditionnel
Fermé
pcouas
Messages postés
28
Date d'inscription
lundi 22 mars 2010
Statut
Membre
Dernière intervention
9 janvier 2022
-
23 oct. 2010 à 07:39
pcouas - 29 oct. 2010 à 13:17
pcouas - 29 oct. 2010 à 13:17
A voir également:
- MYSQL Suppression et Creation conditionnel
- Forcer suppression fichier - Guide
- Creation compte gmail - Guide
- Création compte google - Guide
- Media creation tool - Télécharger - Systèmes d'exploitation
- Création site web - Guide
4 réponses
pcouas
Messages postés
28
Date d'inscription
lundi 22 mars 2010
Statut
Membre
Dernière intervention
9 janvier 2022
Modifié par pcouas le 24/10/2010 à 09:41
Modifié par pcouas le 24/10/2010 à 09:41
Bonjour,
J'ai essaye ceci sans succes
IF((SELECT count(*) FROM mysql.USER WHERE user='user1')>0,
REVOKE ALL PRIVILEGES ON DB.* FROM 'user1'@'localhost';
REVOKE ALL PRIVILEGES ON DB.* FROM 'user1'@'%';
DELETE FROM mysql.USER where user='user1';
FLUSH PRIVILEGES;
DROP USER 'user1'@'localhost';
DROP USER 'user1'@'%';,,)
J'ai essaye ceci sans succes
IF((SELECT count(*) FROM mysql.USER WHERE user='user1')>0,
REVOKE ALL PRIVILEGES ON DB.* FROM 'user1'@'localhost';
REVOKE ALL PRIVILEGES ON DB.* FROM 'user1'@'%';
DELETE FROM mysql.USER where user='user1';
FLUSH PRIVILEGES;
DROP USER 'user1'@'localhost';
DROP USER 'user1'@'%';,,)
Et si tu fait plutôt
https://dev.mysql.com/doc/refman/8.0/en/control-flow-functions.html
CASE WHEN (SELECT count(*) FROM mysql.USER WHERE user='user1')>0) THEN REVOKE ALL PRIVILEGES ON DB.* FROM 'user1'@'localhost'; REVOKE ALL PRIVILEGES ON DB.* FROM 'user1'@'%'; DELETE FROM mysql.USER where user='user1'; FLUSH PRIVILEGES; DROP USER 'user1'@'localhost'; DROP USER 'user1'@'%'; END;
https://dev.mysql.com/doc/refman/8.0/en/control-flow-functions.html
pcouas
Messages postés
28
Date d'inscription
lundi 22 mars 2010
Statut
Membre
Dernière intervention
9 janvier 2022
25 oct. 2010 à 06:35
25 oct. 2010 à 06:35
Bonjour
pour l'instant cela me donne une erreur
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CASE WHEN (SELECT count(*) FROM mysql.USER WHERE user='user1')>0)
THEN
RE' at line 1
pour l'instant cela me donne une erreur
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CASE WHEN (SELECT count(*) FROM mysql.USER WHERE user='user1')>0)
THEN
RE' at line 1