Remote MySQL Dump not working with cnf file
Or you can put the credentials in a .cnf file in the correct section. Mysql commands will search that file and use those. This is typically how servers do local backups and maint scripts and such things. I.e.
In /etc/my.cnf
# bottom of my.cnf file
# include all files from the config directory
#
!includedir /etc/my.cnf.d

Then in some file such as /etc/my.cnf.d/credentials.cnf
#
[client]
user                  =  admin
password              =  ';\m^P[9MVJ'
#
[mysqldump]
user                  =  root
password              =  ';\m^P[9MVJ'
#

Make only root has rights to read them. I.e.
-rw-------. 1 root root  657 Dec 1 14:22 /etc/my.cnf.d/client.cnf