2 added 2 characters in body
source | link

I have MySQL password saved on a file foo.txtphp, for example P455w0rd, when I try to use it:

$ cat foo.txtphp | grep 'mydb:''$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?

I have MySQL password saved on a file foo.txt, for example P455w0rd, when I try to use it:

$ cat foo.txt | grep 'mydb:' | 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?

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?

1
source | link

How to pass password to mysql command line

I have MySQL password saved on a file foo.txt, for example P455w0rd, when I try to use it:

$ cat foo.txt | grep 'mydb:' | 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?