I am trying to connect to a MySQL database on my local machine. I am able to connect using MySQL Workbench, but when I try to use sqlalchemy it does not allow me to connect.
The user has the correct permissions. I can connect using MySQL bench so I know the credentials are correct.
engine = create_engine('mysql://username:password!@ ***.***.***.**:3306/ceesmart')
connection = engine.connect()
OperationalError: (_mysql_exceptions.OperationalError) (2006, "Unknown MySQL server host ' . . *. ' (2)") (Background on this error at: http://sqlalche.me/e/e3q8 )
I don't know if it was on copying and pasting here, but you have an "space" between the @
and the first octect:
@ ***.*
^ here
That could make the engine to try to resolve it as a DNS name instead of an IP address, therefore, raising Unknown Host
exception
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.