Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

4 Answers 4

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.

share|improve this answer

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

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.

share|improve this answer
up vote 0 down vote accepted

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.


share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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