mysql-config-editor is the answer for the million dollar question of how to pass the mysql passwords saerway, when user has access to the database server terminal.
This tool mysql_config_editor will created encrypted .mylogin.cnf file, this will resolve the age old problem of reading cleartext password for the mysql scripts.
Command has the following options:
set [command options] Sets user name/password/host name/socket/port
for a given login path (section).
remove [command options] Remove a login path from the login file.
print [command options] Print all the options for a specified
reset [command options] Deletes the contents of the login file.
help Display this usage/help information.