Delete a service key getting error Error: Error 1396 (HY000):
search cancel

Delete a service key getting error Error: Error 1396 (HY000):

book

Article ID: 443430

calendar_today

Updated On:

Products

VMware Tanzu Platform Core VMware Cloud on AWS

Issue/Introduction

While attempting to delete the service key, you may encounter an error.

cf delete-service-key MY-SERVICE MY-KEY

Are you certain that you want to delete the service key MY-KEY? [yN]: y
Deleting key MY-KEY for service instance MY-SERVICE as user..
Job (################) failed: unbind could not be completed: Service broker failed to delete service binding for instance poi-api-aurora-db: Service broker error: unbind failed: Error: Error 1396 (HY000): Operation DROP USER failed for ‘########’@‘%’ exit status 1
FAILED

Environment

VMware Cloud on AWS

Cause

 

Broker has a record of a service key/binding.

Broker attempts to delete the corresponding MySQL user from Aurora.

User is already missing in Aurora.

DROP USER fails with Error 1396.

Service key deletion fails.

 

Resolution

1. Verify whether the user exists

SELECT User, Host
FROM mysql.user
WHERE User = '########';

If no rows are returned, the broker is trying to delete a user that is already gone.

2. Recreate the user

For Aurora MySQL 5.7/8.0:

CREATE USER '###########'@'%' IDENTIFIED BY '############';

No grants are typically required because the broker only needs the user to exist so that DROP USER succeeds.

Verify:

SHOW GRANTS FOR '###########'@'%';

3. Retry deleting the service key

cf delete-service-key MY-SERVICE MY-KEY