I'd like to login Putty and MySQL in one step. How to do it?
I tried this way but it only logins Putty.
I'm using Windows. If possible please show more a Linux version.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
PuTTY has a configuration option to run a specific shell command after connecting to the SSH server. You can set this as part of a saved configuration, i.e.
Skynet - start MySQL.
As Ben Orchard notes, you will still want to enter your SQL password manually, as opposed to storing it as part of a configuration file.
You could place a few lines in your shell profile on the machine you are connecting to to automatically login to MySQL if you it detects you are using SSH. See here:
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then mysql -u a_user -p fi
Put those lines at the end of your shell profile (e.g. ~/.bash_profile). When you login via SSH, your shell should prompt you for your MySQL password immediately when you connect via SSH.
I'm not certain if you can pass your MySQL password as an argument, if you that's what you wanted - and I suggest against it, because it would not be very secure at all.
The problem got solved (on Windows).
Install MTPuTTY. Browse to your Putty location.
Setup a session: host, username, password. This step enables automatically login to Putty.
Choose Script tab. Enter the scripts you want to run after login to Putty. Set delay time ~2000 milliseconds.
I know this post is a little old, but for anyone else looking for a similar tool to solve this problem, then SuperPutty is 100% the best Windows tool for Putty, not only supports multiscreen instances, but also can run putty commands to login on launch.