Table doesn't exist trying to connect to RDS mysql Database

101 views Asked by At

I am having trouble connecting to the RDS database I created from the Elastic beanstalk console. The app is deployed ok, but I get an internal server error from the webpage every time I try using the database in the app. For example, if I try to add a user.

Here is one of the logs

pymysql.err.ProgrammingError: (1146, "Table 'ebdb.note' doesn't exist")
    SQLALCHEMY_DATABASE_URI = ("mysql+pymysql://"+ os.environ['RDS_USERNAME'] + ":" 
                                         + os.environ['RDS_PASSWORD']+ "@" 
                                         + os.environ['RDS_HOSTNAME'] 
                                           + ":3306/ebdb")

config.py

from dotenv import load_dotenv

load_dotenv()  # Load environment variables from .env file

class Config:
    SECRET_KEY = os.getenv('SECRET_KEY') 
       SQLALCHEMY_DATABASE_URI = ("mysql+pymysql://"+ os.environ['RDS_USERNAME'] + ":" 
                                         + os.environ['RDS_PASSWORD']+ "@" 
                                         + os.environ['RDS_HOSTNAME'] 
                                           + ":3306/ebdb")
    SESSION_PERMANENT = False 
 

I have the RDS database set to publicly accessible.

0

There are 0 answers