MySQL is a popular database powering many of the highest traffic sites in the world. Render Disks make it effortless to deploy production-grade MySQL on Render backed by high performance SSDs with automatic daily snapshots.
Render private services are only visible to other Render services in your account. They have internal URLs like
mysql:3306, can speak any protocol and can listen on any port. Render automatically detects the ports for your services when they are deployed.
Let’s get started!
master branch for Render’s MySQL repo runs MySQL 8. If you need MySQL 5, make sure to select the
mysql-5 branch when you create your service below.
If you are using MySQL as the database for a production Ghost 5 deployment on Render, you must use MySQL 8 for your production database.
Click Deploy to Render below and follow the prompts to set up MySQL on Render.
Fork render-examples/mysql on GitHub or click the green ‘Use this template’ button.
Create a new Private Service on Render, and give Render permission to access your new repo.
mysql-5branch in this step if you want to deploy MySQL 5.
Use Docker for the Runtime and add the following environment variables under Advanced:
my_database(or your preferred database name)
mysql(or your preferred DB username)
A secure password for
A secure password for the MySQL
Add a Disk under Advanced with the following values:
10 GB Feel free to change this to match your requirements.
The MySQL Docker image writes data to
/var/lib/mysql. The Mount Path must match this exactly. Setting a different Mount Path does not change the MySQL configuration, and will result in lost data.
That’s it! Save your private service to bring up MySQL which will take a few minutes to start. Future deploy should be much faster.
Your MySQL instance will be available on the displayed URL as soon as the deploy is live. The URL should look like
You can connect to MySQL from other applications running in your Render account using the name and port for your Private Service. For example, you can a create a Web Service to manage your MySQL database using Adminer. See our Adminer Deployment Guide for details.
You can also use SSH or the shell in your dashboard to connect to your database.
Learn more about connecting to MySQL.
mysql -h localhost -D $MYSQL_DATABASE -u $MYSQL_USER --password=$MYSQL_PASSWORD
mysql: [Warning] Using a password on the command line interface can be insecure.
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 92
Server version: 8.0.29 MySQL Community Server - GPL
Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Relying on a disk snapshot to restore a database is not recommended. Restoring a disk snapshot will likely result in corrupted or lost database data.
Using a database’s recommended backup tool (for example: mysqldump) is the recommended way to backup and restore a database without corrupted or lost data.