Solve the Problem of mysql being unable to insert Chinese data and displaying garbled characters after insertion. [graphic comments for test !]
(1) Not much nonsense. It means that you cannot enter Chinese characters when using the mysql database. If you can enter Chinese characters, garbled characters are displayed !!
(2) No more! Start solving the problem! Step 1: Find the mysql installation directory and find the my. ini file;
Step 2: use NotePad to open the my. ini file,
Find this location and check whether the default-character-set is utf8. If not, change it to utf8! (This sentence may not have been added in previous versions !)
# MySQL client library initialization. [client] port = 3306 [mysql] default-character-set = utf8
Step 3: Enter show variables like '% char %' in the Command box of the mysql database ';
View the encoding format of the database! The image will be displayed here. The image will be changed later!
Step 4: Change the encoding method of the original database:
Set character_set_database = utf8; set character_set_server = utf8; set character_set_client = gbk; set character_set_connection = gbk;
Step 5: Change the encoding method:
Step 6: Try inserting Chinese data! OK! Yes, it can be inserted!
Step 7: Solve the garbled characters shown in the first figure when selecting * from table
Change the encoding method above! Set character_set_results = gbk; it can be displayed normally!
(3) The solution has been described in detail above!
However, we need to note that sometimes we need to solve the input and display garbled characters by following the "Step 4" and "Step 7" when adding data!
It is worth noting that when using myeclipse, the provided DBBrowser will not contain garbled characters!
OK! Wish you success!