1

Mysql version : 8.0.12 on WAMP Server (apache 2.4.33)

In my.ini I added (then restarted mysql multiple times):

[mysql]
default-character-set=utf8mb4

[mysqld]
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci

I have a mysql table stores with a column coordinates varchar(255) utf8mb4_unicode_ci.

I get this error while trying to update stores column:

SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xFAC3OJ]...' for column 'coordinates' at row 1 (SQL: update `stores` set `updated_at` = 2018-09-12 11:01:48, `coordinates` = ST_GeomFromText('POINT(-117.161084 32.715738)') where `id` = 3)

What am I doing wrong?

I tried the query directly in the phpMyAdmin and I get the same error.

Victordb
  • 519
  • 1
  • 11
  • 25
  • Possible duplicate of ["Incorrect string value" when trying to insert UTF-8 into MySQL via JDBC?](https://stackoverflow.com/questions/10957238/incorrect-string-value-when-trying-to-insert-utf-8-into-mysql-via-jdbc) – Alexandre Elshobokshy Sep 12 '18 at 08:16
  • 2
    How is this possible duplicate as I mentioned I added `utf8mb4` to my.ini and my column is utf8mb4? – Victordb Sep 12 '18 at 08:17

1 Answers1

2

The data type for column coordinates should not be a string, as in varchar(255), but a geometry.

See https://dev.mysql.com/doc/refman/8.0/en/spatial-type-overview.html

Marc Alff
  • 8,227
  • 33
  • 59