The create table zeng0822 (
Id int primary key auto_increment,
Sname varchar (10) not null default ", "
Gender char (1) not null default ", "
Company varchar (20) not null default ", "
Salary is a decimal (6, 2) not null default 0.00,
Fanbu smallint not null default 0
) engine myisam charset utf8;
problem a:
add data found in the process of gender column to write "male" errors;
problem two:
For the first time the sname column to add two words of Chinese name is no problem, the second chose sname/gender/salary three columns to add data, tell me
ERROR 1366 (HY000) : Incorrect string value: '\ x80 \ xE9 \ x94 \ x8B' for column 'sname' at row 1,
Problem a I directly enter 1 to temporarily solve the problem insert, but do not understand;
problem two looked through many ways, including in/etc. My new CNF file (lead to can't start the mysql) instead, unifying the mysql database is set to: GBK format, and so on are bad to use,
Great god help solve self-study small white for all of you!
CodePudding user response:
Change varchar to nvarcharCodePudding user response:
Gender field to the first question is char (1) type, is a byte, can only enter a number or a letter, a Chinese characters including 2 bytes, so don't go in,CodePudding user response:
The second problem, should be the problem of database character encoding, suggest amend the database encoding utf8 format,Reference: https://blog.csdn.net/weixin_43249665/article/details/87946287