I have MySQL password saved on a file foo.php
, for example P455w0rd
, when I try to use it:
$ cat foo.php | grep '$dbpwd=' | cut -d '"' -f 2 | mysql -U root -p mydb -h friendserver
Enter password: (holds)
$ echo P455w0rd | mysql -u root -p mydb -h friendserver
Enter password: (holds)
Both option still ask for password, what's the correct way to send password from stdin
?
-p
and your password./proc
can trivially read them as long as the program is running. That's what a~/.my.cnf
is for, properly chmod'ed to 0600