1. pip install mysqlclient failed(solution见下)
export PATH="$PATH:$HOME/.rvm/bin:/usr/local/mysql/bin"
2. Library not loaded: @rpath/libmysqlclient.21.dylib
copy /usr/local/mysql/lib/libmysqlclient.18.dylib to /usr/local/lib/libmysqlclient.18.dylib
PS: 其他缺失库同理
3. Can't initialize character set utf-8 (path: /usr/local/mysql/share/charsets/
solution: charset='utf-8’
改为charset='utf8’
(rerfer: https://stackoverflow.com/questions/37709659/mysqldb-cant-initialize-character-set-utf-8-error)```
4. 1062, "Duplicate entry 'd335db26ecd8e7e2a6ac7ef7973b2bcf' for key 'PRIMARY'"
sql语句问题,重复key的话改为更新语句
sql = """
insert into article(title, title_id, content)
values(%s, %s, %s) ON DUPLICATE KEY UPDATE content=values(content)
"""