Please note that these documents apply to OpenShift Online v2 only (accounts created before August 1st, 2016).
If you are using one of the OpenShift 3 products, please refer to documents available at


ClearDB is a reliable, fault tolerant database-as-a-service for your MySQL powered applications.


The ClearDB dashboard can be accessed by visiting:

ClearDB Dashboard

The ClearDB dashboard allows you to manage your database, monitor performance, access backups, and view your credentials. You can also manage your support cases, among other things.

Integrating the Service With Your App

Once you have subscribed to this service and located your credentials, you will need to configure your application to use the credentials for your service.

ClearDB Environment Variables

We recommend setting the following environment variables within your application runtime to connect the service to your app:

Variable Name

Example Value













Use the OpenShift client tools to set environment variables to make your credentials available within your application runtime:

$ rhc env set CLEARDB_JDBCURL=VALUE -a App_Name
$ rhc env set CLEARDB_NAME=VALUE -a App_Name
$ rhc env set CLEARDB_PASSWORD=VALUE -a App_Name
$ rhc env set CLEARDB_PORT=VALUE -a App_Name
$ rhc env set CLEARDB_URI=VALUE -a App_Name
$ rhc env set CLEARDB_USERNAME=VALUE -a App_Name
Check out the general code examples to see how to use environment variables within your application.

Code Examples

The following code example shows how to easily configure your application to connect to a MySQL database provided by ClearDB.


Connecting to ClearDB from PHP merely requires the parsing of the cleardb_* environment variable and passing the extracted connection information to your MySQL library of choice, e.g. MySQLi:

$CLEARDB_URL = parse_url(getenv("CLEARDB_URI"));

$conn = new mysqli(

You can then issue queries against the database using $conn→query().

Additional Resources

Additional documentation is available at


Need help with your ClearDB database? Having trouble doing something that ordinarily "just works"? We’re here to help. If you’ve already checked out our FAQ and our support community doesn’t have a resolution to the issue, please create a new support case so our team can assist in resolving the issue you’re experiencing.

Once we receive your support request, we will verify your account and begin to diagnose and identify the problem that you’re experiencing. If we need more information, one of our team members will contact you. Once we have resolved the issue, we’ll send you an email asking for you to verify that the problem has been rectified. Upon conformation that the problem has been resolved, we’ll close the issue.