Comments - mariadb drop user "wildcard"

2 years, 7 months ago Mark Edwards

excellent! thank you. i have never used "PREPARE" before so this makes a great introduction.

i should think that there would be a one-liner, but this is certainly the next best option.

 
2 years, 7 months ago Daniel Black

In slightly shorter form:

SELECT GROUP_CONCAT(QUOTE(user),'@',QUOTE(host)) INTO @accounts FROM mysql.user WHERE user = 'ILOVEMARIADB';
EXECUTE IMMEDIATE CONCAT('DROP USER ', @accounts);
 
2 years, 7 months ago Mark Edwards
SELECT GROUP_CONCAT(QUOTE(user),'@',QUOTE(host)) INTO @accounts FROM mysql.user WHERE user = 'ILOVEMARIADB';
EXECUTE IMMEDIATE CONCAT('DROP USER ', @accounts);

thank you Daniel! life keeps getting better and better (while the solution shrinks). it still surprises me this requires a procedure, but this is EXCELLENT!

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.