Connect to Your CodeRed Database#

CodeRed databases are designed to be used directly by your website. However, they can be connected to externally using standard MySQL/MariaDB or PostgreSQL clients.

Step 1: Install a Client#

This guide will use the official mysql client shipped with MySQL and psql command shipped with PostgreSQL. If you do not have these installed, follow our guides:

Step 2: Obtain Your CodeRed Database Credentials#

From the CodeRed Dashboard, select your website and then select the Database tab. This will provide the connection info. To retrieve the password, click the Show Production/Staging password button.

Note

For enhanced security, database passwords are automatically rotated every time your app is deployed. This password is therefore temporary and should never be stored or used in code.

Step 3: Connect to the Database via Terminal#

The CodeRed Dashboard Database tab also provides a command line snippet which can be copy/pasted into your terminal. Enter the password from Step 2 above when prompted.

All database connections require SSL (TLS). Modern versions of MySQL and PostgreSQL clients attempt to connect over SSL by default, however older versions or other tools may require an --ssl-mode or sslmode flag.

% mysql -h <host> -u <user> -p <database_name>