Test-Connect from Python SQLAlchemy

Hello, i was able to import a small test mysql db to InfinityFree -
Now i want to access this db with python using sqlalchemy

Therefore i try to establish the connection with this statement:
engine = create_engine ("mysql+pymysql://epiz_26274076:[email protected]:3306/epiz_26274076_testdb")

Using the parameters according to the sqlalchemy docu:
dialect+driver://username:password@host:port/database

But everytime i try to run the code i get an error:
ConnectionRefusedError: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte

Any ideas what can be wrong here?

This is my whole test code:

from sqlalchemy.sql import text
from sqlalchemy import create_engine

#engine = create_engine ("mysql+pymysql://root:(HIDDEN BY MOD)@localhost/stockdb?host=localhost?port=3306")
#engine = create_engine ("mysql+pymysql://epiz_26274076:(HIDDEN BY MOD)@sql100.epizy.com/epiz_26274076_testdb")
engine = create_engine ("mysql+pymysql://epiz_26274076:(HIDDEN BY MOD)@sql100.epizy.com:3306/epiz_26274076_testdb")

conn = engine.connect ()

lst_stock_incstat = []
t = text ("select * "  # 0, 1
          "from actor where actor_id < :w")
result = conn.execute (t, w=10)
4 Likes

OK - that means connecting to the db from python is only possible in the paid version - Right?

Correct!

2 Likes

You can also use an external MySQL server if you don’t want to upgrade.

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