Home  >  Article  >  Operation and Maintenance  >  Mysql garbled problem under linux

Mysql garbled problem under linux

王林
王林Original
2019-11-05 10:02:112387browse

Mysql garbled problem under linux

Solution:

1. First enter msyql, and then use show variables like 'character%' to perform encoding display. You can see the following figure:

Mysql garbled problem under linux

The default is that both the client and the server use latin1, so the characters will be garbled.

2. Modify the /opt/lampp/etc/my.cof file

Mysql garbled problem under linux

Add the above statements under mysql, mysqld, and client respectively.

Note: If the error cannot be started after modification, try changing default-character-set=utf8 to character_set_server=utf8; here I am I encountered this problem, so after removing the default, it was normal. default-character-set=utf8 was not used in the script.

3. Use the command drop database database name to delete the created database

4. Restart the mysql service:

/opt/lampp/lampp restart

5. Re-create the database and table structure, and insert again The data can be used normally

Recommended tutorial:linux tutorial

The above is the detailed content of Mysql garbled problem under linux. 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
Previous article:linux>How to exitNext article:linux>How to exit