Accessing your database before DNS change

From DreamHost
Jump to: navigation, search

Overview

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:

  1. Create a dreamhosters.com subdomain.
  2. Using that subdomain, create a MySQL hostname.
  3. 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:

  1. Navigate to the (Panel > 'Goodies' > 'MySQL Databases') page.
    The MySQL Databases page opens:
    Accessing your Database add hostname.fw.png
  2. Click the Add New Hostname button.
    The ‘Add a MySQL Hostname’ page opens:
    Accessing your Database create hostname.fw.png
    Note2 icon.png Note: In the above example:
    • The primary domain is “dhwiki.dreamhosters.com”.
    • The MySQL hostname is “mysql.dhwiki.dreamhosters.com”.


  3. Enter the hostname prefix of your choice (commonly "mysql"), and then select the new subdomain using the dropdown menu.
  4. 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:

  1. Find the data center for your database.
  2. Find your database server name.
  3. 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:

Accessing DB before DNS Change datacenter.fw.png

The data center your databases are hosted in determines which of the three following base URLs you’re going to use:

  • http://www.mysql-losangeles.dreamhosters.com/dh_phpmyadmin/
  • http://www.mysql-irvine.dreamhosters.com/dh_phpmyadmin/
  • http://www.mysql-virginia.dreamhosters.com/dh_phpmyadmin/

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:

Accessing DB before DNS Change SQL servername.fw.png

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:

Accessing DB before DNS Change VPS servername.fw.png
  • MySQL VPS = PSMYSQLNUMBER.dreamhostps.com
Accessing DB before DNS Change DP servername.fw.png
  • DreamPress = WPSQLNUMBER.dreamhostps.com
Accessing DB before DNS Change DED servername.fw.png
  • 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:

http://www.mysql-irvine.dreamhosters.com/dh_phpmyadmin/overholtzer.turkeyfish.dreamhost.com/

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:

VPS
http://www.mysql-irvine.dreamhosters.com/dh_phpmyadmin/psmysql7xxxx.dreamhostps.com/
DreamPress 
http://www.mysql-virginia.dreamhosters.com/dh_phpmyadmin/wpsql1890xxx.dreamhostps.com/
Dedicated Server
http://www.mysql-irvine.dreamhosters.com/dh_phpmyadmin/ds6xxx.dreamservers.com/