Accessing your database before DNS change
- 1 Overview
- 2 How to connect with a temporary MySQL hostname
- 3 How to connect with an internal URL
To access your MySQL database, you need a unique hostname (domain name) or IP address for your MySQL server. This hostname can be any name you wish, so long as you have registered it, but it is commonly a subdomain of your primary domain and is named "mysql.domain.TLD". For example, let’s say your domain is mywebsite.com: you can then create the subdomain "mysql.mywebsite.com" which is used to connect to your database server.
This arrangement is convenient to use with DreamHost's MySQL installations, as you can create and manage all of your databases from the (Panel > 'Goodies' > 'MySQL Databases') page.
However, during a server or web host migration, the DNS for "yourdomain.tld" may not point to DreamHost's nameservers, so you won't be able to use a subdomain of "yourdomain.tld" for the MySQL hostname.
With DreamHost's setup, your MySQL server (which hosts all of your databases) is accessible from any subdomain that you assign to it within your DreamHost account. Thus, you can still access any of your DreamHost-hosted MySQL databases by creating a temporary MySQL subdomain within your panel.
How to connect with a temporary MySQL hostname
As stated above, you can access your database while the DNS of your primary site is not pointed to DreamHost. This requires three steps:
- Create a dreamhosters.com subdomain.
- Using that subdomain, create a MySQL hostname.
- Use this MySQL hostname to access your database via phpMyAdmin.
Step one: Adding a dreamhosters subdomain
Add a free dreamhosters.com subdomain that mirrors your primary domain on the (Panel > 'Domains' > 'Manage Domains') page.
For more detailed instructions about this process, please view our wiki:
Step two: Adding a MySQL hostname
To add a hostname for your new subdomain:
- Navigate to the (Panel > 'Goodies' > 'MySQL Databases') page.
- Click the Add New Hostname button.
Note: In the above example:
- The primary domain is “dhwiki.dreamhosters.com”.
- The MySQL hostname is “mysql.dhwiki.dreamhosters.com”.
- Enter the hostname prefix of your choice (commonly "mysql"), and then select the new subdomain using the dropdown menu.
- Click the blue Create this MySQL hostname now! button to finish.
Step three: Accessing your database with phpMyAdmin
Once the DNS changes propagate (which may take anywhere from 4 to 24 hours), you are then able to access the phpMyAdmin MySQL management utility using the mysql hostname you just created. In the example above, it would be mysql.dhwiki.dreamhosters.com.
If you try to access phpMyAdmin before the MySQL hostname's DNS records are updated, DreamHost's phpMyAdmin interface will be unable to recognize your login information.
For further information about phpMyAdmin and how to log in, please view the following wiki:
How to connect with an internal URL
If you need to access phpMyAdmin immediately and aren’t familiar with how to modify your local computer’s hosts file, you can access your database using a temporary URL.
Here's how you do it:
- Find the data center for your database.
- Find your database server name.
- Compose the URL.
Step one: Identifying in which data center your databases are hosted
You can do this on the (Panel > 'Support' > 'Data Centers') page:
The data center your databases are hosted in determines which of the three following base URLs you’re going to use:
The above image states that the database is in the Irvine data center, so you'd start with the first part of the URL: “http://www.mysql-irvine.dreamhosters.com/dh_phpmyadmin/”.
Step two: Finding the full name of your MySQL server
You can do this on the (Panel > 'Goodies' > 'MySQL Databases') page:
Internally, the hostname for your MySQL server is translated from SERVER:SERVICE into SERVICE.SERVER.dreamhost.com. So in the example image, "turkeyfish:overholtzer" is translated to ‘overholtzer.turkeyfish.dreamhost.com’.
A note for VPS/DreamPress/Dedicated Servers
If the database you're trying to access is on a MySQL VPS, DreamPress, or a Dedicated Server, your MySQL server has a different internal hostname:
- MySQL VPS = PSMYSQLNUMBER.dreamhostps.com
- DreamPress = WPSQLNUMBER.dreamhostps.com
- Dedicated Server = DSNUMBER.dreamservers.com
Step three: Composing the URL
The last step is to compose the URL by appending the internal hostname from step two to the base from step one.
Using the images from the last two steps, the following is URL is created:
When you enter this URL, a MySQL login prompt appears. You can now log in to phpMyAdmin and import your database.
Additional examples for VPS/DreamPress/Dedicated Servers:
- Dedicated Server