Home  >  Article  >  Database  >  What should I do if Chinese characters in mysql are displayed as question marks?

What should I do if Chinese characters in mysql are displayed as question marks?

王林
王林Original
2020-09-30 13:26:3010859browse

Solution to solve the problem that Chinese characters in mysql are displayed as question marks: 1. Open the my.ini configuration file; 2. Add [character-set-server=utf8] under the mysqld node and save the file; 3. Restart mysql That’s it.

What should I do if Chinese characters in mysql are displayed as question marks?

First open the my.ini configuration file

(Recommended tutorial: mysql tutorial)

Then modify the

[mydqld] and [client] sections in my.ini as follows to add

default-character-set=utf8 (some versions do not support default-character-set=utf8, use character_set_server=utf8 can replace default-character-set=utf8)

If there is no [client], manually add the [client] segment

[1]Add it under the [client] node ( If this is another character_set_server=utf8, if I write it like this, I will report error 1067 [mysql service cannot be started], you can try it) (This is the encoding configuration of the client)

default-character-set=utf8

[2] In [mysqld] Add under the node (this is the server-side encoding configuration) (Note: collation is the sorting method)

character-set-server=utf8
collation-server=utf8_general_ci

Finally restart mysql.

Related recommendations: php training

The above is the detailed content of What should I do if Chinese characters in mysql are displayed as question marks?. For more information, please follow other related articles on the PHP Chinese website!

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