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".
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;
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!)
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:
Step 5: Changed encoding Method:
Step 6: Try inserting Chinese data! OK! It can be inserted!
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!
(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!