hello all , i am new to this environment and i started developing my app when i started to get to the part i needed to use a database i did the next
- went to the database tab and created a database and i set a mysql password.
- From bash console i checked if i can access the database and all was fine.
- in my main python_loader.py i did these codes and all of them result the same problem.
(I am using python 2.7 , and my app is flask project related)
this is first try using sqlalchemy
from sqlalchemy import create_engine
app = Flask(__name__)
engine = create_engine('mysql://Sosolo:password@mysql.server/Sosolo$database-name')
engine.connect()
this is second try using sqlalchemy
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://Sosolo:password@mysql.server/Sosolo$database-name'
db = SQLAlchemy(app)
and last this is using MySQLdb
import MySQLdb as sql
app = Flask(__name__)
db = sql.connect(host='mysql.server', user='Sosolo', passwd='pass', db='db')
cursor = db.cursor ()
all of them lead me to this Error
return Connection(*args, **kwargs)
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host 'mysql.server' (0) ")
i really don't understand the connections or how it should work correctly please help me thanks in advance