Home >Database >Mysql Tutorial >What should I do if Chinese characters in mysql are displayed as question marks?
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.
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!