I'm trying to create a Web application using flask and Flask-SQLAlchemy, I have the following code
from flask.ext.sqlalchemy import SQLAlchemy
from flask import Flask
app= Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+mysqldb://root:[email protected]/testdb'
db = SQLAlchemy(app)
When I run db.create_all() from command line, I get "unknown database 'testdb'" error.
I'm working on Ubuntu but the code above works on my Windows machine.
I've tried adding the port number, removing the python connector but nothing works. Below is the stack trace
File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
sqlalchemy.exc.OperationalError: (OperationalError) (1049, "Unknown database 'testdb'") None None