You might want to specify the protocol (like ‘tcp‘), instead of localhost directly.
See those examples:
user:password@tcp(localhost:5555)/dbname
In your case:
username@tcp(localhost)/my_db
Note, if you use the default protocol (tcp) and host (localhost:3306), this could be rewritten as
user:password@/dbname
Lakshminarayanan Guptha adds in the comments:
In my case
- user:password@tcp/dbnameworked