Home > Database > Mysql Tutorial > body text

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

王林
Release: 2020-09-30 13:26:30
Original
10846 people have browsed it

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
Copy after login

[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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template