Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

插入sql报错 #39

Closed
Tianyu97 opened this issue Mar 18, 2020 · 1 comment
Closed

插入sql报错 #39

Tianyu97 opened this issue Mar 18, 2020 · 1 comment

Comments

@Tianyu97
Copy link

Tianyu97 commented Mar 18, 2020

运行search_word报错信息:
(1366, "Incorrect string value: '\xE5\xB9\xB412\xE6...' for column 'weibo_from' at row 1")

估计是不能有中文字符. 查了一下说要把charset设置成utf8
可是我看那个config.py里已经设置了charset=utf8. ...

SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://{}:{}@{}:{}/{}?charset=utf8'.format(MYSQL_USERNAME, MYSQL_PASSWORD,MYSQL_HOST, MYSQL_PORT, MYSQL_DATABASE)

然后试着修改表set character_set_database=utf8;gbk也试过了...但是每次重新链接mysql的时候又恢复原先的设置了...
大家有遇到这个问题吗,怎么解决呢

@Hatcat123
Copy link
Contributor

不仅在链接的时候设置utf-8,而且也要确定再创建数据库的时候,设置数据库格式为utf-8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants