I have a database with the character set configured for utf8mb4 and collate as utf8mb4_general_ci but when I run the command
CREATE TEMPORARY TABLE TESTE(
CAMPO VARCHAR(200)
);
INSERT INTO TESTE (CAMPO) VALUES ('é');
select * from TESTE;
it returns me the error
1 Incorrect string value: '\xE9' for column 'CAMPO' at row 9 SQL1.sql 9 20
what happens is that I am using a LOAD DATA INFILE to INSERT values in my database and I need my table to accept accented characters
I run this in mysql 8.0.19 and as you see in 5.7
CREATE TEMPORARY TABLE TESTE( CAMPO VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ); INSERT INTO TESTE (CAMPO) VALUES ('é');
✓ ✓
select * from TESTE;
| CAMPO | |:---- | | é |
db<>fiddle here
both work just fine.
check your database, Table/column somewhere you don't have the right characterset
Had to change the character set of the values that i was INSERTING on my table to latin1
I was using
LOAD DATA INFILE 'pathToMyFile.csv'
INTO TABLE myTable
FIELDS TERMINATED BY ';'
so i had to add the command CHARACTER SET latin1
soo my code now is like
LOAD DATA INFILE 'pathToMyFile.csv'
INTO TABLE myTable
CHARACTER SET latin1
FIELDS TERMINATED BY ';'
and worked fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.