Compose Database-as-a-Service Help and Documentation

Everything you need to know about Compose, Hosted or Enterprise, is here in our help system. Whether you run one database for your businesses' sole application or six different databases to support an entire corporation, we've got the information you need.

Connecting to Compose for MySQL - Old

Creating a deployment

To create a Compose for MySQL deployment:

  • Sign in to your Compose account
  • From the Deployments view, click on Create Deployment
  • Select MySQL from the Beta selection of databases.

The New MySQL Deployment panel opens:

New deployment panel.

New deployment panel.

The Compose system generates a deployment name and selects AWS US-East-1 as the location for the new database deployment. You can change the database's name and the data center location; in the latter case selecting from Amazon, Google and SoftLayer data centers. See Compose Datacenter Availability for a full list of available locations. There's also a slider which allows you to select the amount of disk storage your deployment should initially be allocated. You can leave it as is and let Compose's autoscaling system allocate storage as needed, or you can dial in your requirements and configure your deployment with that much space up front. Autoscaling will still work if you manually select your database size.

When you have completed the form, click Create Deployment and Compose will begin provisioning your database. When your deployment is created a database called compose is also created by default.

When provisioning is complete you'll see this:

The Deployment Overview page.

The Deployment Overview page.

You'll find the information needed to connect to your deployment in the Connection info panel. The connection information contains three values:

  • Credentials - the password for the admin user
  • Connection string - you use this with database drivers to automatically connect
  • Command line - you use this to manually log in to the database.

Connecting to Your Deployment

To connect to Compose for MySQL using the command line, you first have to install MySQL on your machine. Each platform has its own installation packages, so choose the one that works best for you. You can find Oracle community packages at http://dev.mysql.com/downloads/. Before you download from there, be aware that on Linux you will usually find MySQL in your distributions repository.

If you're using a Mac, you can install MySQL with Homebrew, which compiles and installs the latest version of MySQL:

brew install mysql

To access your deployment via the terminal, copy and paste the command line string provided in the Connection info panel into your terminal to connect to your deployment:

Example connection string with the `-ssl` flag set.

Example connection string with the -ssl flag set.

To enable SSL when connecting, use --ssl-mode=REQUIRED. The default user is named "admin" which you use as the username in the -u parameter. After running the command, you'll be prompted to enter the admin user's password, which you can get from the credentials section of the Connection info panel:

Credentials from the Connection info panel.

Credentials from the Connection info panel.

Compose for MySQL has SSL enabled by default, but when connecting, you should take extra precautions by using the--ssl-mode=REQUIRED option on the command line. This stops MySQL falling back, for whatever reason, to an unencrypted connection. If you want to test unencrypted connections you can disable SSL by using --ssl-mode=DISABLED.

To verify which host you are connecting to, you can obtain a self-signed certificate for the MySQL server from the Compose web console.

To view the certificate, click Show certificate in the SSL Certificate (Self-Signed) panel. You might be asked for your Compose username and password for re-authentication before being given your self-signed certificate:

Example SSL certificate.

Example SSL certificate.

To use the certificate:

  • Create a new file and copy everything from ---BEGIN CERTIFICATE--- to ---END CERTIFICATE---.
  • Save the file with the .pem extension. The file is used to verify the certificate that the server presents the MySQL command line tool and ensure that you are connecting to the right host.
  • Change the --ssl-mode parameter to --ssl-mode=VERIFY_CA and add --ssl-ca with the path and name of your .pem file:
Example  `mysql` connection string.

Example mysql connection string.

When you have successfully logged in, you should see something like this:

The `mysql` shell.

The mysql shell.


Still Need Help?

If this article didn't solve things, summon a human and get some help!

Connecting to Compose for MySQL - Old