1067 – Invalid default value for ‘sex‘1366 – Incorrect string value: ‘\xE6\x8A\x80\xE6\x9C\xAF…‘ f

1067 – invalid default value for ‘sex’
the above error occurred when using SQL statement to create a table in Navicat,
cause: the character set code of the default table is Latin1, so it’s OK to insert numbers, Insert Chinese characters will report an error
solution: alter database database name/table name character set utf8
1366 – incorrect string value: ‘Xe6/x8a/X80/Xe6/x9c/XAF…’ for column ‘depname’ at row 1
reason: the above consistency
problem is that the character set code of the database has been changed before, why the same problem will appear
check the database and I want to The character set code of the inserted table is UTF-8, but the table is not

alter table dep  character set utf8

Still report the same error
check the field code

the character code of the field is Latin_ 1
helpless 😔
change the fields

ALTER TABLE dep CHANGE depname depname 
VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci;

Finally, it has become
but it’s very troublesome to change it all the time. It’s better to change the configuration file of MySQL once and for all


Read More: