MySQL

The Railway MySQL database service allows you to provision and connect to a MySQL database with zero configuration.

Deploy

You can add a MySQL database via the CMD + K menu or by clicking the + New button on the Project Canvas.

GIF of the Adding Database

Connect

Connect to MySQL from another service in your project by referencing the environment variables made available in the MySQL service:

  • MYSQLHOST
  • MYSQLPORT
  • MYSQLUSER
  • MYSQLPASSWORD
  • MYSQLDATABASE
  • MYSQL_URL

Connecting externally

It is possible to connect to MySQL externally (from outside of the project in which it is deployed), by using the TCP Proxy which is enabled by default.

Keep in mind that you will be billed for Network Egress when using the TCP Proxy.

Image

The MySQL database service uses the mysql:latest docker image.

Changing System Variables

Tailor your MySQL service to your needs by adding any variables relevant to the mysql image.


Edit this file on GitHub