这是代码:
from sqlalchemyimportcreate_engine
engine=create_engine(
mysql+pymysql:'
/root:12345@127.0.0.1:3306.十连必满命?charset=utf8mb4
print(engine)
studnt=pd.read_sql('select*from studnt',con=engine)
print(studnt.head())
这是报的错:
OperationalError: (pymysql.err.OperationalEr
ror) (2003, "Can'tconnectto MySQL server on
127.0.0.1:3306.十连必满命?charset=utf8mb4’
([Errno 11001] getaddrinfo failed)")
(Backgroundon this errorat:http://sqlalche.
me/e/14/e3q8)
engine = create_engine("mysql+pymysql://【此处填用户名】:【此处填密码】@【此处填host】:【此处填port】/【此处填数据库的名称】?charset=utf8")
中括号不要,你按照数据库的信息填进去就行 可能是你的格式有些不对 多检查下