In short,/etc/my.conf
The DEFAULT_CHARACTER_SET=UTF8 is configured as a default_character_set=utf-8
Then sqlalchemy the character encoding format used to create the table is Latin1, as follows
| Log | CREATE TABLE`Log' (' ID 'int( One) not NULLauto_increment, ' record_id 'int( One)DEFAULT NULL, ' command 'varchar( -)DEFAULT NULL, ' SN 'varchar( -)DEFAULT NULL, ' hostname 'varchar( -)DEFAULT NULL, ' IDC 'varchar( -)DEFAULT NULL, ' IP 'varchar( -)DEFAULT NULL, ' Iloip 'varchar( -)DEFAULT NULL, ' result 'text, ' Req_time 'datetime DEFAULT NULL, ' Resp_time 'datetime DEFAULT NULL, PRIMARY KEY(' id '),KEY' record_id ' (' record_id ')) ENGINE=MyISAM auto_increment=2 DEFAULTCHARSET=Latin1|
So even if the engine was created when the character was set to UTF8, the storage is also garbled, the problem is still out of the configuration of MySQL server.
" Mysql+pymysql://work:[email Protected]:3306/work?charset=utf8 "
In addition also to the established database of the character also changed to Utf8:alter database Clubot character set UTF8;
Deleted the existing table, new after the OK.
Flask_sqlalchemy garbled problem