FutureQuest, Inc. FutureQuest, Inc. FutureQuest, Inc.
Knowledgebase: PHP/MySQL
Accessing MySQL via SSH?
Posted on 11 March 2004 09:02 AM


How can I access my MySQL databases via SSH?


To access your MySQL databases via SSH, you should log in to your shell account using an SSHv2-compatible client of your choice. For suggestions of SSH clients to use, see:

Use your regular shell username and password (the same ones you use to enter your CNC) to establish the SSH session.

Once you have established an SSH session, then from the command line, you would issue a command something like this:

mysql -uxmysqlusername -p -h mysql.example.com xdatabase

(You will need to make the substitutions as outlined below. Refer to the MySQL Account Manager in your CNC for your MySQL username, host name, and database name(s).)

-u is the switch to specify the user. Replace xmysqlusername with your MySQL username.

-p tells MySQL to prompt for a password

-h tells MySQL what host to use. Your host is mysql.example.com where "example.com" is replaced with your actual domain name.

xdatabase in the above command line instruction is the name of the database. Replace xdatabase with the full name of your database.

After substituting your information in the above command and hitting ENTER, you should then be prompted for your MySQL password.

(If you have forgotten your MySQL password, you will be able to reset it through the MySQL Account Manager in the CNC. Note that doing so will change the MySQL password for all of your MySQL databases under that package and any scripts dependent on that password will need to be updated.)

Once you have provided the correct password, you will be logged in to the MySQL Monitor. From the mysql prompt, you will be able to enter MySQL queries at the command line.

For additional assistance with possible MySQL commands available for your use, please consult the documentation at: