KB / Account Control Panel / Goodies :: MySQL

From DreamHost

Jump to: navigation, search

View and manage your existing MySQL databases and users. You can also add new databases or delete existing ones. You can create as many MySQL users and Databases as you like on any of our plans.

We are currently running MySQL version 4.1. Once you've created a MySQL database and a MySQL user, it's easy to access:

  • Log into your home machine (eg: venkman.dreamhost.com) as usual.
  • Once you're logged in, type the following at the shell prompt:
mysql -h host -u user -p db
where host is the MySQL Host Name, user is your MySQL Username, and db is your MySQL Database name.
  • Enter your MySQL password when you're prompted for it.
  • Start creating your tables and all that good stuff.

We also have a new feature! You can now access all MySQL databases with us via a web interface (phpMyAdmin)! Simply go to your database's host on the web! So if your MySQL host was mysql.mydomain.net, just point your browser to http://mysql.mydomain.net/!

Contents

Parent Article

How do I back up my database?

To backup your MySQL database you can:

  • Use phpMyAdmin and use the options there to dump the contents to a text file.
  • From the shell, run this command:
mysqldump --opt -uusername -ppassword -h yourMySQLHostname dbname > filename.sql

To restore your database from a backup:

  • Take that db dump and do:
cat filename.sql | mysql -uusername -ppassword -h yourMySQLHostname dbname </ol>

How long does it take for a new database to start working?

Typically it'll take about 5-10 minutes after you create a database through our web panel before the new mysql hostname you've created will work. The actual database is created immediately, but you won't be able to access it until the hostname propagates!

Hang in there!

Is there an easier way to manage my database?

Yes!

Once you have a hostname and username/password for your database you can just connect to your databases via the phpMyAdmin web interface.

Simply go to your database's hostname using your web browser! So if your MySQL hostname was mysql.mydomain.net, just point your browser to http://mysql.mydomain.net/

For dedicated customers use: http:://mydomain.net/dh_phpmyadmin/mysql.mydomain.net

If you plan on importing data via CSV file make sure you use the Load method : DATA LOCAL in phpmyadmin.

If you'd like to have phpMyAdmin disabled for any databases you have with us, please just contact support and they can turn it off!

What username/password do I use to connect to my database?

If you don't know what the username/password to use for your MySQL database is, then chances are that you never set one up.

Go to the Goodies::MySQL section of the webpanel.

Then click on "Add User" to add a mysql user for your database (to use for your connections and scripts).

You could name your user the same thing as your Web ID, but you can choose whatever name/password you like.

Once you set one up, you'll probably want to configure your scripts to use that value to connect to your database.

How to recover a lost mysql password from the admin panel

Go to the Goodies::MySQL section of the webpanel

Click on the desired username and on the next page you will see their password in italics. It is located towards the bottom, you can also use this page to change the user's password.

What hostname do I use to connect to my database?

Firstly: it is NOT "localhost"!

If you don't know what the hostname for your MySQL database is, then chances are that you never set one up.

Go to the Goodies::MySQL section of the webpanel

Then click on "Add MySQL Hostname" to add a hostname for your database (to use for your connections and scripts).

You'll probably want to name your hostname "databasename.yourdomain.com" but you can choose whatever name you like.

Once you set one up, you'll probably want to configure your scripts to use that value to connect to your database.

NOTE: Since about mid-2006 all new databases you create should be on the same MySQL server and thus the hostnames should be inter-changeable so you can access all your databases from a single hostname. Databases you created prior to this time will not necessarily be on the same MySQL server, and may still have their own hostname(s).

This also means that when creating new databases you should not reuse db names, even when the dbs appear to be hosted on different servers.

Personal tools