mysql出现ncorrectstringvalue:'\xF0\x9F...'forco

1)、修改数据库的编码为utf8bm4

创新互联于2013年创立,是专业互联网技术服务公司,拥有项目做网站、网站建设网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元泉港做网站,已为上家服务,为泉港各地企业和个人服务,联系电话:18982081108

# vi /etc/my.cnf

[client]

default-character-set = utf8mb4

[MySQL]

default-character-set = utf8mb4

[mysqld]

character-set-client-handshake = FALSE

character_set_server = utf8mb4

collation-server = utf8mb4_unicode_ci

init_connect='SET NAMES utf8mb4'

重启服务

systemctl restart mysqld.service 

2)、修改数据表的编码为utf8bm4

mysql> ALTER DATABASE voice_reports_test CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

mysql> ALTER TABLE ZSCC_WRK_BSE_CKLCC CONVERT to CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; 

SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';

+--------------------------+--------------------+

| Variable_name            | Value              |

+--------------------------+--------------------+

| character_set_client     | utf8mb4            |

| character_set_connection | utf8mb4            |

| character_set_database   | utf8mb4            |

| character_set_filesystem | binary             |

| character_set_results    | utf8mb4            |

| character_set_server     | utf8mb4            |

| character_set_system     | utf8               |

| collation_connection     | utf8mb4_unicode_ci |

| collation_database       | utf8mb4_unicode_ci |

| collation_server         | utf8mb4_unicode_ci |

+--------------------------+--------------------+

10 rows in set (0.00 sec)

3)、修改连接数据库的连接代码


当前名称:mysql出现ncorrectstringvalue:'\xF0\x9F...'forco
本文链接:http://myzitong.com/article/jdsjgj.html