Error reading database/*/*: Error making API request. 1 error occurred: * failed to find entry for connection with name: “dev”

If you are trying to generate dynamic secret on vault and you are getting the following error. this could help.

Error reading database/creds/dev: Error making API request.

URL: GET http://127.0.0.1:8200/v1/database/creds/dev
Code: 500. Errors:

* 1 error occurred:
        * failed to find entry for connection with name: "example"

This actually is complaining about the db name are different apart from the role name. The funny thing is you need to keep the dev name the same as the role name. In my case, I need to create a role called example to handle the example db.

vault write database/roles/dev \
    db_name=dev \
    creation_statements="CREATE USER '{{name}}'@'%' IDENTIFIED BY '{{password}}';GRANT ALL ON example.* TO '{{name}}'@'%';" \
    default_ttl="1h" \
    max_ttl="24h"