How to remove ERROR 1366 (HY000): Incorrect string value: '\xF4\xA9"\xDA\xA7\x0D...'?

In my database there is a table:
CREATE TABLE `customer` (
`customer_id` INT AUTO_INCREMENT,
`first_name` varchar(40) NOT NULL,
`last_name` varchar(40) NOT NULL,
the `phone` varchar(30),
`email` varchar(50),
`street` varchar(50),
the `city` varchar(50) DEFAULT "Lviv",
`state` varchar(50),
`zip_code` varchar(50),
`login` varchar(150) NOT NULL,
`password` varchar(255),
PRIMARY KEY (`customer_id`)
);

I had to make a trigger that encrypts the password:
CREATE TRIGGER customer_password BEFORE
INSERT ON customer FOR EACH ROW
SET NEW.password = AES_ENCRYPT(NEW.password, 'test');

And when I try to insert an item into the table:
INSERT INTO customer VALUES (NULL, 'Petroror', 'Petro', NULL, 'pet@gmail.com', 'Zelena', 'Lviv', NULL, NULL, 'petros', 'mypass');

I get this error:
ERROR 1366 (HY000): Incorrect string value: '\xF4\xA9"\xDA\xA7\x0D...' for column 'password' at row 1

utfmb4 tried..
April 19th 20 at 12:05
2 answers
April 19th 20 at 12:07
Solution
https://dev.mysql.com/doc/refman/8.0/en/encryption...
and returns a binary string containing the encrypted output

Why binary chunk of data is bad data for a text field? Well, just absolutely incomprehensible.
Use the appropriate data type.
Thank you, you helped me a lot. - macy.Deckow commented on April 19th 20 at 12:10
April 19th 20 at 12:09
Solution
AES_ENCRYPT returns not a string but a binary BLOB.
If you want to text, use HEX().
Thank you, you helped me a lot. - macy.Deckow commented on April 19th 20 at 12:12

Find more questions by tags MySQL