Wednesday, 9 March 2022

MYSQL how to check if created user exists

 https://stackoverflow.com/questions/3049929/checking-if-mysql-user-exists


72

MySQL stores user data in a table called user in a database named mysql (by default). The following query will return 1 if a user with the specified username exists, 0 otherwise.

SELECT EXISTS(SELECT 1 FROM mysql.user WHERE user = 'username')

No comments:

Post a Comment