Originally Posted by chrism01
You seem to be trying to login at the Linux level with ssh, but you also need to login to mysql separately.
I know the dba acct in mysql is called 'root', but its got nothing to do with the Linux root acct; you'll need a separate set of credentials.
Can I also persuade you not to use plaintext passwds for ssh (use ssh auth-keys) and disable root via ssh entirely, even on the loopback interface. You never know who's 'listening' and its a bad habit to get into.
If MySQL is listening on 127.0.0.1, you can just use the mysql client direct ie no ssh reqd.
You are making a point here.
It depends on what you want to do. But for most cases public/private keypairs would make login possible without password.
By default the mysql root user can login without password from the host were it is running.
THen you can just do:
ssh $user@$host "mysql-command"
In that case you don't even need expect.