The following describes how to connect to your DreamHost database(s) using a third-party program.
If you have a DreamPress plan, you can only access your associated MySQL database(s) using either of the following methods:
Connecting to your MySQL database using a third-party program
To connect to your MySQL database remotely using a third-party program like MySQL WorkBench, you must first give your local machine permission to connect to the database server. This must be done for all MySQL user accounts you plan on logging in with from your local machine.
To grant permission for MySQL user accounts:
- Navigate to the MySQL Databases page in the panel.
- Under the 'Database(s) on this server:' section, find the desired database and then click the Users with access link for the user you wish to grant access.
- Scroll down to the 'Allowable Hosts' section and enter the domain or subdomain your local machine identifies itself as on the public Internet. Follow the formatting conventions described on the web page. You must include either your public IP address or your public originating domain/subdomain (such as rr.com, mindspring.com, comcast.com, and so on).
To find your public IP address, go to What is My IP?.
Your IP address is also displayed in the panel after editing your MySQL username. Under the 'Allowable hosts' section it says:
Your current computer is: XXX.XXX.XXX.XXX
You can copy and paste this IP address as needed.
- Enabling %.example.com does not enable the hostname 'example.com' by itself.
- If you receive an "access denied to email@example.com" error, try adding a wildcard to the end of your ip (such as xxx.xxx.xxx.xxx%).
- When finished, click the Modify [username] now! button.
- Launch your third-party program, enter the database and login information, and then connect.
If you're using a third-party program via a secure SSH tunnel to connect
Connecting using PuTTY v0.63
You can use PuTTy to access your MySQL database via a secure SSH tunnel. This method is preferred over less secure methods as it provides point-to-point encryption and does not expose your MySQL account to potential hacks from allowed networks.
The following three steps set up a secure SSH tunnel:
- Step one: Creating a user with Shell (SSH) access
- Step two: Launching PuTTy
- Step three: Using the third-party tool
Step one: Enabling SSH on your account
- Go to your DreamHost Account Control Panel.
- Edit the user you wish to grant SSH access.
- Under "User Type:", choose "Shell user".
- Make sure /bin/bash is your shell type.
- Click Save Changes.
Step two: Launching PuTTY
- Download and launch PuTTy.
- In the category tree on the left, click Connection:SSH:Tunnels near the bottom.
- Enter 3306 in the source port.
- Enter your MySQL database address and port in the destination field (e.g., mysql.example.com:3306).
- Use all other defaults (local, auto) and click Add.
- Click Session in the category tree.
- Enter your shell account address in the Host Name field (e.g., psxxxxxx.dreamhostps.com).
- Ensure that port 22 and SSH are specified under prototcol.
- Give your session a name and click Save.
- Log into your shell account using your newly created session.
- Minimize the window.
Step three: Using a third-party tool
- Open the third-party tool, such as MySQL WorkBench.
- Enter localhost under Server Host.
Entering your actual address (e.g., mysql.example.com) does not work here. You must use localhost.
- Enter 3306 as the port.
- Enter your db username and password.
- Click OK.
After you complete the step three, you should be able to connect to your MySQL database.
- Your PuTTY session must be active and you must be logged in for the tunnel to work.
- If you are running a local MySQL db, you can specify a different port for your tunnel. Otherwise, you cannot access your local mysql connection while the tunnel is active.
- To specify a different port:
- Enter a different number (e.g., 3307) in the source port field under Tunnels in PuTTY.
- Use the same number as your port in the MySQL Administrator Port field.
- Your destination port must remain 3306. The idea is that you're sending data to port 3307 on your end, the data is sent through the tunnel, and then is shunted to port 3306 on DreamHost's end.
Connecting using SSH
If you are running a local MySQL server on port 3306, you must set up port forwarding in your ~/.ssh/config, as follows:
- Enter the following settings:
Host your_nickname_for_your_host HostName your_dh_host_name.dreamhost.com User your_shell_account_user_name LocalForward 3307 your_full_db_host_name:3306
- Enter the following to connect:
[server]$ ssh your_nickname_for_your_host [server]$ mysql -h 127.0.0.1 -P 3307 -u db_user_name -p
- Optionally, use the following single command line:
[server]$ ssh -4fNg -L 3307:your_full_db_host_name:3306 your_shell_account_user_name@your_dh_host_name.dreamhost.com
- Connect with mysql as above.
- Despite adding localhost as a valid host for your user on the MySQL Databases page, you may encounter this error message:
ERROR 1045 (28000): Access denied for user 'db_user_name'@'localhost' (using password: YES)
- Use 127.0.0.1 instead of localhost (it's blocked by DH).
- If connecting via command line, you must use the MySQL -P flag and specify port 3307 as in the following:
[server]$ mysql -u username -p -h 127.0.0.1 -P 3307
Connecting using Sequel Pro (Mac OSX)
If you're using Apple Mac OSX, you can you can use the open source Sequel Pro software to connect to a DreamHost MySQL database.
To connect with your DreamHost database using Sequel Pro:
- Use the Standard connection tab and enter the following:
- Name: [optional]
- Host: [your MySQL host name: mysql.example.com]
- Username: [your database user name]
- Password: [your database user password]
- Database: [optional]
- Port: 
- Click Connect.
Once you are connected, select the database from the drop-down menu on the top left.
A more secure method is to use the SSH tab when creating the connection/favorite. You must first configure a user for SSH access under Users > Manage Users in your DreamHost panel. With these details in hand, you can configure the following additional options:
- SSH Host: [SSH host name]
- SSH User: [Username of an SSH enabled user]
- SSH Password: [Password for the account]
- SSH Port: 
Connecting to your MySQL database using DreamHost's phpMyAdmin at your own domain
See the phpMyAdmin article for further details.