Overview
This article explains how to connect to your database via SSH. The instructions below explain how to log into your DreamHost webserver to connect, but you can also connect to your database the same way from your home computer.
Prerequisites
This article assumes you have created a shell user and are able to log into your server via SSH.
Connecting from a shell account
Log into your MySQL database using your database credentials. View the Finding your database credentials article for instructions. You can also find these in the panel under MySQL Databases.
- Obtain your database credentials.
It's not possible to localhost to connect to your database, as DreamHost's MySQL servers are on a separate database server.
- Log into your server via SSH.
- Run the following command.
[server]$ mysql -h hostname -u user -p database
- Enter your password when prompted.
Once logged in, your command prompt will change to the following:
mysql>