'sqlalchemy root password with @ , show error (2003, "Can't connect to MySQL server on '16535@localhost' ([Errno 11003] [duplicate]
code
engine = sqlalchemy.create_engine('mysql+pymysql://root:Sakura%s@16535@localhost:3306/'+coin[x])
error
exc
sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2003, "Can't connect to MySQL server on '16535@localhost' ([Errno 11003] getaddrinfo failed)")
Any help? Thank you
Solution 1:[1]
Important
Percent encoding must be used for reserved characters in the elements of the URI-like string. For example, if you specify a string that includes the @ character, the character must be replaced by %40. If you include a zone ID in an IPv6 address, the % character used as the separator must be replaced with %25.
So the quick answer is to replace the @ symbol with %40. In general you can encode a string in a URI-safe manner as follows, working in Python:
import urllib.parse
encoded = urllib.parse.quote_plus(unencoded)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
