mysql password from a file

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.
mysql_config_editor set --password
Use ~/.my.cnf:

Or specify one on the command line: mysql --defaults-extra-file=/some/where/mysql_password (format of that file is the same as ~/.my.cnf).
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.

Just my 2 cents here of course.