Issues Running Alembic Migration using Render MySQL


I’m trying to host a backend web service connected to a MySQL database on Render. So far, what I’ve done is set up the MySQL private service as per Deploy MySQL | Render · Cloud Hosting for Developers and connected the Github repo that has the code for my Python 3 service.

At the moment, I’m trying to use alembic to run database migrations against this newly set up MySQL instance. In order to do so, I’m trying to configure the database string used by Alembic to connect to the database to run these migrations.

So far, I’ve set up an environment variable for this. It uses PyMySQL as the connector with SQLAlchemy and the connection string that I have is: mysql+pymysql://root:<root_password>@<mysql_instance:mysql_port>/<database_name>

Everything in the above string in brackets was replaced by the parameters I found on the private service that represents the MySQL instance that I launched on Render. When I then SSH into my web service to run the Alembic command, I get the following error:

sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (1045, "Access denied for user 'root'@<IP_ADDRESS> (using password: YES)")

Is there anything I’ve done wrong here? When I use the same PyMySQL DB string locally, I have no issues running migrations against my local database setup. Help is appreciated!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.