Updated on 2023-11-03 GMT+08:00

Error Reported During User Creation

Scenario

The saas_cash_user user fails to be created after the following SQL statement is executed:

/*COMMON SETTINGS*/ CREATE USER 'saas_cash_user'@'10.11.3.%' IDENTIFIED BY '******'

Error: (conn=288831) Operation CREATE USER failed for 'saas_cash_user'@'10.11.3. %'

Possible Causes

If a user is deleted using the delete command, an error is reported when the user is created again.

Generally, you can use the create user or grant statement to create a user. A user created using the create syntax does not have any permission, and you need to use the grant syntax to assign permissions. A user created using the grant syntax has the assigned permissions.

When you use the drop user statement to delete a user, the database table and permission table are deleted together. However, delete from mysql.user only deletes records in the user table. If you run show grants for username, you can find that the permissions of the user still exist. In this case, creating a same user can fail due to a verification failure.

Solution

To delete a user, run the drop command.