0
votes

I am trying to connect to an RDS instance with flask-sqlalchemy. But i cant get it to work. I am getting the error

sqlalchemy.exc.OperationalError: (MySQLdb._exceptions.OperationalError) (1049, "Unknown database 'dbname'")¨

My database URI looks like this

SQLALCHEMY_DATABASE_URI = 'mysql://username:[email protected]:3306/dbname'

I have tried using the pymysql plugin, but it didnt make any difference.

I think my security groups are setup correctly. On the RDS instance it is this

i

(I dont know if security groups contain any personnel info)

1
AWS will create the initial database for you if you specify the database name in the "Additional Configuration" section of the "Create Database" page.SuperShoot

1 Answers

1
votes

Try creating the database first:

import pandas as pd
import sqlalchemy 

mysql_engine = sqlalchemy.create_engine("mysql://username:[email protected]:3306")

pd.read_sql_query("create database dbname", con=mysql_engine)