Bug #39303 When using 'mysql -p <file', password is read from the file
Submitted: 8 Sep 2008 9:06 Modified: 10 Sep 2008 18:26
Reporter: River Tarnell Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S2 (Serious)
Version:5.0.67 OS:HP/UX (B.11.23)
Assigned to: CPU Architecture:Any

[8 Sep 2008 9:06] River Tarnell
Description:
When using 'mysql -uroot -p <file', instead of prompting for a password, it immediately treats the first line of the file as the password.  This makes it impossible to import SQL into the server (unless using '-pabcde', which is rather insecure).

I confirmed this by replacing the first line of the file with 'foo' (it echoed three stars) and then with the actual password (and then it imported fine).

This seems to be HP-UX specific; I didn't observe it using the same version on Solaris.

How to repeat:
$ mysql -uroot -p < wiki.sql wiki 
Enter password: *******************
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[10 Sep 2008 18:26] Sveta Smirnova
Thank you for the report.

Verified as described.
[2 Dec 2010 9:54] Kent Boortz
The HP-UX 11.11 platform is not supported any more, but as was verified for 11.23 as well, changed the OS field.