How to fix when database does not exist error comes while you already have it ?
This isn't a bug and almost certainly the database does indeed exist in whatever cluster the command you are running is being executed against. There isn't a "fix", only a methodical exploration of the various moving parts in your environment to find out where the gap between expectation and reality is (or where there is a misconfiguration).