Home  >  Article  >  Database  >  How to solve the problem that mysql cannot input Chinese

How to solve the problem that mysql cannot input Chinese

WBOY
WBOYOriginal
2022-01-20 10:45:5014377browse

In mysql, you can modify the content of the "my.ini" file to solve the problem of not being able to input Chinese. Open the "my.ini" file in the mysql directory and change the content of the "default-character-set" item. , change the content of this item to "utf8".

How to solve the problem that mysql cannot input Chinese

The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.

How to solve the problem that mysql cannot input Chinese

Step one: Find the directory where mysql is installed and find the my.ini file;

How to solve the problem that mysql cannot input Chinese

Step 2: Use Notepad to open the my.ini file,

Find this place and see if the default-character-set is utf8. If not, just change it to utf8! (Previous versions may not have this sentence, just add it directly!)

How to solve the problem that mysql cannot input Chinese

Step 3: Enter: show variables like'%char% in the mysql database cmd ';

Check the encoding format of the database! The picture will be displayed here. It will be shown later that the picture has been modified!

Step 4: Change the encoding method of the original database:

How to solve the problem that mysql cannot input Chinese

How to solve the problem that mysql cannot input Chinese

Step 5: Changed encoding Method:

How to solve the problem that mysql cannot input Chinese

Step 6: Try inserting Chinese data! OK! It can be inserted!

How to solve the problem that mysql cannot input Chinese

Step 7: Solve the garbled code shown in the first picture when selecting * from table

Change the above encoding method! set character_set_results=gbk; will display normally!

How to solve the problem that mysql cannot input Chinese

(3) The solution has been introduced in detail above!

But what we need to pay attention to is that sometimes when adding data, we still have to follow the "fourth step" and "seventh step" to solve the problem of inputting and displaying garbled characters!

It is worth noting that when we use myeclipse, the DBBrowser provided will not appear garbled!

Recommended learning: mysql video tutorial

The above is the detailed content of How to solve the problem that mysql cannot input Chinese. 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