www.rodneybeede.com "I would love to change the world, but they won't give me the source code" - unknown
 Navigation

MySQL, -p, and no space between password - Last Modified 2009-04-10 15:37 UTC - Created 2009-04-10 15:37 UTC

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.