So for the mysql command line utilities (ex: mysqldump) you can specify the password on the command-line with -pPASSWORD or --password=PASSWORD. You cannot have a space in between like "-p PASSWORD".

I was wondering why and found the following bug report that explains it. In short the password value is optional since -p alone means prompt the user for the password. Most other utilities use something like "-p -" to indicate prompt from STDIN for the password. MySQL does not.

One shouldn't pass the password on the command-line anyway. You're better off putting it in a mysql.ini and securing the file instead if you need it for automation.