1

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.

2

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.

enter image description here

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.

1

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.

0

The problem got solved (on Windows).

  1. Install MTPuTTY. Browse to your Putty location.

  2. Setup a session: host, username, password. This step enables automatically login to Putty.

  3. Choose Script tab. Enter the scripts you want to run after login to Putty. Set delay time ~2000 milliseconds.

DONE!

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.