Skip to main content
Question Protected by dr_
added 2 characters in body
Source Link
Kokizzu
  • 10.6k
  • 18
  • 64
  • 89

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?

Source Link
Kokizzu
  • 10.6k
  • 18
  • 64
  • 89

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?