Here's an interesting command to store the password for the current user I found with a few minutes of research. Seems to create a ~/.mylogin.cnf file, after which you can just run mysql without any password options specified.
Still... Even though ~/.my.cnf works there's nothing wrong with doing this in a different way (another file which you're using through the cat command or a shell redirect as shown above). As long as you make sure to keep them secured of course.
Here's the thing: ~/.my.cnf would be the first thing an attacker might look for whereas that other weird named file which you're using is likely to be easily overlooked. Of course, one could argue that whenever a 3rd party has access to these files then you'd have much different problems to cope with, but even so... It is something I always like to keep in mind as well. When it comes to security I often prefer doing things differently, just to avoid the most obvious (theoretical) targets.