Scalingo for MySQL®

Scalingo for MySQL® is the official MySQL® addon provided by Scalingo, details on the available plans can be found here. This addon gives your app instant access to a MySQL® database running in its own Docker container.

Adding Scalingo for MySQL® to Your App

You can add the Scalingo for MySQL® addon through the dashboard or through the command line interface. The capacity of your database is elastic, you will be able to upgrade it later.

Through the Dashboard

  1. Go to your app on the Scalingo Dashboard
  2. Click on Addons tab
  3. Select the addon you want to add
  4. In the dialog select the database plan you need
  5. Validate your choice

Through the Command-Line Interface

$ scalingo --app my-app addons-add mysql mysql-starter-1024

-----> Addon mysql has been provisionned
       ID: my-app-3030
       Modified variables: [DATABASE_URL SCALINGO_MYSQL_URL]
       Message from addon provider: Database successfully created

This command will provision the application my-app with a mysql-starter-1024 Scalingo for MySQL® database plan.

To find out what other plans are available:

$ scalingo addons-plans mysql

Scalingo for MySQL® Cluster Setup

If using a Business plan for your Scalingo for MySQL® addon, we setup a MySQL® InnoDB cluster. This cluster has the following configuration:

  • three MySQL® nodes in a private network: the amount of memory per node depends on the plan,
  • a couple of MySQL® Routers as entrypoint to the MySQL® private network: one is the leader and the other is just here as a backup in case of failing leader.

The communications in the private network are encrypted.

Getting Your Connection URI

Once the addon is provisioned, 2 environment variables are added to your app: SCALINGO_MYSQL_URL and DATABASE_URL. To find out how to use it in your code please refer to Application environment.

In most cases, you can pass the variable directly to the client library you are using in your code. But sometimes the library requires a specific URI format, you’ll need to add a little bit of code to suit the library.

You can get environment variables from the dashboard or the command line interface.

From the Dashboard

  1. Go to your app on the Scalingo Dashboard
  2. Click on Environment tab
  3. SCALINGO_MYSQL_URL is displayed

From the Command-Line Interface

$ scalingo --app my-app env | grep MYSQL

DATABASE_URL=$SCALINGO_MYSQL_URL
SCALINGO_MYSQL_URL=mysql://my_app_3030:CaUrq1MdUkAzCSEq-1Fg@my-app-3030.mysql.a.osc-fr1.scalingo-dbs.com:30999/my_app_3030

Ruby on Rails Specific

DATABASE_URL is an alias to SCALINGO_MYSQL_URL, the Ruby buildpack will read the value of DATABASE_URL and create the database.yml configuration file accordingly.

If you’re using the mysql2 gem, you will need to copy the value of SCALINGO_MYSQL_URL into DATABASE_URL and change the scheme part from mysql:// to mysql2://.

Remote Access Your Database

If you need to access your database from other places than your app please follow the Access your database guide.

Force TLS Connections

MySQL® support TLS to encrypt all of its network traffic between the client and the server.

By default, all new Scalingo for MySQL® databases have TLS activated. If you want to connect to it, you have nothing to do. The mysql client will automatically first try to connect using TLS, and if it fails will try without TLS. If you want to ensure it connects using TLS, you can use the --ssl-mode option:

mysql --ssl-mode REQUIRED -u <user> --password=<password> -h <host> -P <port> dbname

To activate TLS, you need to restart the database. Any action leading to the restart will activate TLS (e.g. plan update, upgrade of the database).

TLS is an option, you can still access your database without it if needed.

If you want to force connections to your database to use TLS, head to the database dashboard and click on the toggle button:

Note that you must have configured your application to use TLS when connecting to the database.

Some providers like Google Data Studio will require a client certificate when TLS is enabled. In this case, contact us via the in app chat or via email at support@scalingo.com.

Changing Plans

You can upgrade or downgrade your database plan whenever you need it. This operation happens instantly thanks to Docker containers and no manual input is required. When you change the plan, your database will be stopped then restarted on a new host with new parameters of the chosen plan. During the operation the connection is dropped between your app and the database. Finally, after the operation is successful, the related app will be restarted.

From the Dashboard

  1. Go to your app on the Scalingo Dashboard
  2. Click on Addons tab
  3. Select the addon you want to change
  4. In the dialog select the plan you want to upgrade/downgrade to
  5. Validate your choice

From the Command-Line Interface

To upgrade or downgrade your addon the sub-command is the same: addons-upgrade.

$ scalingo --app my-app addons-upgrade ad-0f1ab3e1-e97d-4f33-9168-4956379731a4 mysql-starter-2048

In this example, ad-0f1ab3e1-e97d-4f33-9168-4956379731a4 is the ID of the addon, and mysql-starter-2048 is the plan we want to upgrade to.

To find out the addon ID:

$ scalingo --app my-app addons

+--------+-----------------------------------------+---------------------+
|  ADDON |                   ID                    |        PLAN         |
+--------+-----------------------------------------+---------------------+
| MySQL  | ad-0f1ab3e1-e97d-4f33-9168-4956379731a4 | mysql-business-256  |
+--------+-----------------------------------------+---------------------+

Database Dashboard

The Scalingo for MySQL® dashboard is the central place for administrative tasks such as:

  • Monitor database and system stats
  • Upgrade the database engine version
  • Activate database specific features
  • Manage database users
  • Manage backups

Database Upgrade

When the database vendor releases a new version of your database engine, we will provide it as soon as possible. You will have the choice to upgrade your database with one click through your database dashboard.

If your database uses a business plan, we are able to achieve zero-downtime upgrade.

On single node database, we need to stop the node in order to upgrade it which induces a downtime. The duration of this downtime depends on the amount of data in your database.

When upgrading from MySQ®L 5.7 to 8.0, please check the mandatory prerequisites. Upgrading to MySQL 8.0 is mandatory to benefit from MySQL high availability via business plans.

Container Stats

CPU usage Current CPU usage.
Memory usage Display the current, hightest and free memory. Highest is the maximum memory recorded since database restarted.
Swap usage Display the current, hightest and free swap. Highest is the maximum swap recorded since database restarted.

Database Stats

Database connections Number of currently open and maximum connections.
Data size Logical space reported by the database.
Database on disk size Effective physical space used.

Database Users

By default, Scalingo creates a read and write user on your database with the following rights:

GRANT ALL PRIVILEGES ON <username>.* TO '<username>'@'%'

If you create a new user using the web dashboard, it will get the same rights.

You can also create a read only user with the following rights:

GRANT SELECT, SHOW VIEW ON <username>.* TO '<username>'@'%'

Backups

If your database is in a paid plan (i.e. it’s not “free plan”), we’ll automatically make periodic backups of your database on a daily basis, at around 1:00 AM Central European Time (CET or UTC+0100). The time of your daily backup is configurable via the web dashboard of your database or using the CLI. The scheduled date is not strongly enforce: it might get delayed depending on the load on our infrastructure.

Retention Policy for Daily Backups

We keep a limited amount of backups depending on your database plan. A daily backup is retained for the last 7 days. That means that 7 backups will exist, one for each of the last 7 days. A weekly backup means that only one backup is saved over a 7 days period. A monthly backup means that only 1 backup is saved over the course of a month.

Plan Weekly Backups Retained Monthly Backup Retained
Sandbox/Free N/A N/A
Starter 4 weeks 0 months
Business 8 weeks 12 months

Retention Policy for Manual Backups

You can also manually trigger a backup for your database at any time you want. The number of manual backups that you can retain is limited by your plan:

Plan Backups Retained
Sandbox/Free N/A
Starter 10
Business 50

In case a database is removed from an application, the retention policy remains untouched: backups are not instantly deleted.

Download Automated Backups

Automated backups are listed in the database specific dashboard.

  1. Go to your app on the Scalingo Dashboard
  2. Click on Addons tab
  3. Click Link to dashboard which will take you to the MySQL dashboard
  4. Click on Backups tab
  5. Download the backup you want

Manual Database Backup

If you wish to manually backup your database, please follow How to dump and restore my Scalingo for MySQL® database guide.

Web Administration Tools

phpMyAdmin

phpMyAdmin is a web application to administrate MySQL databases.

The application is available on the platform to use alongside your databases:

  • osc-fr1: Available at https://phpmyadmin.osc-fr1.scalingo.com

  • osc-secnum-fr1: Not available for security reasons: only trusted users are allowed to deploy applications in this region. phpMyAdmin would be a way to reach internal databases without being authorized beforehand.

    Follow these instructions to connect directly to your MySQL database.

How to login?

The server, username and password fields must be filled with the information in your SCALINGO_MYSQL_URL environment variable. Its format is: mysql://<user>:<password>@<host>:<port>/<db name>.

Note that the server input should be in the form host:port.

Adminer

See dedicated page about Adminer


Suggest edits

Scalingo for MySQL®

©2024 Scalingo