Today finally solved the database Chinese garbled problem, share out let more people as reference, we enter the theme:
If the MySQL database is not set when the encoding format, in the future development, the Chinese garbled will be a headache, so I am here to share a complete solution to the garbled method:
I am in the Ubuntu Cloud Server environment under the settings, the operation of the Windows operating system is more simple, here do not repeat, the method is similar, you can access the information themselves.
First enter at the command line:
#cd/etc/mysql
After entering the directory, then modify the my.cnf configuration file (MySQL version above 5.5, now basically is more than this)
#vim my.cnf
Modify the following in the editing area:
[Client]
Default-character-set=utf8
Default-storage-engine=innodb
Character-set-server=utf8
Collation-server=utf8_general_ci
Then save the changes and exit (: Wq)
Then enter:
#mysql-U root-p
Into the database, enter a command to see if the encoding has been modified
Results
To now have modified the encoding format, and then will not appear garbled,, you can insert data to try, hey, as long as the courage to try, the problem will be solved, I believe we can.
by Still,
Solving the problem of Chinese garbled in MySQL database