Open /dev/tty as a file in read-mode, and then read from it.
/dev/tty
Passwords are usually read directly from the terminal. In fact, there's a function getpass that does just this.
getpass
When you pipe in a file, it comes on stdin. Applications that read passwords usually open up a separate input stream.
The best way to accomplish your goal is to use Expect.
#!/usr/bin/expect -fspawn mysqlexpect "*password*"send "your_password_here"