In MySQL Front:
charset: UTF-8 Unicode(utf8)
collation: UTF8_general_ci
The source code file code is set to UTF-8, data base The content of is displayed normally on the web page, but use mysql front to view the content in the database. The Chinese content in the database is all Garbled code . In the console mode, the contents of the viewed database are also garbled. Sometimes it is inconvenient for me to debug the program, especially when backing up the database, once there is Chinese data in the table, the database cannot be restored successfully.
I checked online and found that Navicat can solve this problem, which is also available in the Huajun Software Park (but there seems to be a 30 day use limit, which is not good). After installing the software settings: connection Advanced Settings Encoding: select UTF-8 and cancel the Use MySQL character set option. After a trial, the UTF-8 encoding support is really good.
Postscript: I tried to backup and restore the database just now. Hey, the effect is really good```
Just right click the database and click "Dump SQL File" for backup, which is very convenient.
I found another method on the Internet, which is to use the built-in backup function of MySQL without using other tools: mysqldump - uroot - p123456 login_development>c: 1.txt. When I opened the backup txt file, the Chinese data in it was still garbled
As for navicat's 30 day limit, it seems that the cracked version has not been found on the Internet. Anyway, I haven't found it. But after deleting HKEY_USERS S-1-5-21-004336348-838170752-682003330-1003 Software PremiumSoft, it seems that it will re read the local system's time limit for 30 days and re-establish the key:)
A few hours later, I added again: finally, the MySQL Chinese problem was solved. I simply recorded that the method is to first create the database table according to the utf8 code, especially in the fields with Chinese, and then add the sentence encoding: utf8 in database.yml. In addition, I also tried to use the above mysqldump backup without any garbled code problem.