Home >Backend Development >PHP Tutorial >The current encoding of MYSQL data is like this. Why is it still garbled when inserting Chinese characters?

The current encoding of MYSQL data is like this. Why is it still garbled when inserting Chinese characters?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-08-04 09:19:331052browse

Do I need to change the rest of the database and server? I use wamp and I don’t know how to change it. After setting it up like this and restarting, it looks like in the picture

<code>SET character_set_database = utf8;
SET character_set_server = utf8;
</code>

I have set three
[client] [mysql] [mysqld] in my.ini. These three settings have become utf8 and it doesn’t work either
The current encoding of MYSQL data is like this. Why is it still garbled when inserting Chinese characters?

Reply content:

Do I need to change the rest of the database and server? I use wamp and I don’t know how to change it. After setting it up like this and restarting, it looks like in the picture

<code>SET character_set_database = utf8;
SET character_set_server = utf8;
</code>

I have set three
[client] [mysql] [mysqld] in my.ini. These three settings have become utf8 and it doesn’t work either
The current encoding of MYSQL data is like this. Why is it still garbled when inserting Chinese characters?

<code>+--------------------------+-----------------------------------------------------------------+
| character_set_client     | utf8                                                            |
| character_set_connection | utf8                                                            |
| character_set_database   | utf8                                                            |
| character_set_filesystem | binary                                                          |
| character_set_results    | utf8                                                            |
| character_set_server     | utf8                                                            |
| character_set_system     | utf8</code>

Is the question inserted through the web page or the terminal?

There is also the encoding of the table. The key lies in the encoding of the table

<code>create table employee
(
  //..............
) DEFAULT CHARSET=utf8;</code>

Write the table creation statement like this, and set the encoding of the table to utf-8, which may solve the problem.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn