环境: MariaDB 5.5.60 , MySQL Workbench 6.3
1,导入数据时,遇到类似:
Traceback (most recent call last):
File "/Applications/MySQLWorkbench.app/Contents/Resources/libraries/workbench/wizard_progress_page_widget.py", line 192, in thread_work
self.func()
File "/Applications/MySQLWorkbench.app/Contents/Resources/plugins/sqlide_power_import_wizard.py", line 125, in start_import
retval = self.module.start(self.stop)
File "/Applications/MySQLWorkbench.app/Contents/Resources/plugins/sqlide_power_import_export_be.py", line 271, in start
ret = self.start_import()
File "/Applications/MySQLWorkbench.app/Contents/Resources/plugins/sqlide_power_import_export_be.py", line 420, in start_import
query = """PREPARE stmt FROM 'INSERT INTO %s (%s) VALUES(%s)'""" % (self._table_w_prefix, ",".join(["`%s`" % col for col in dest_col_order]), ",".join(["?" for i in dest_col_order]))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128)
ERROR: Import data file: 'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128)
Failed
原因:导入的目标表的字段,可能使用的系统保留字,例如 name,type,key,value......., 看来保持好的命名习惯很重要。
2,导入乱码,导入的中文 都转换成了 ???
检查数据库,表的编码方式,使用workbench 自动生成的表,每个字段都设置了collation,默认latin1。