MySQL often appears in the Chinese support unfriendly situation common error "illegal mix of collations for operation"
Let's do a regular set of what character sets are involved in the MySQL database
Character-set-server/default-character-set: Server character set, by default
Character-set-database: Database Character Set
Character-set-table: Database table Character Set
In general, you only need to set up character-set-server, and when you create databases and tables, you do not specifically specify character sets, so the character-set-server character set is used uniformly.
Character-set-client: Client's character set
Character-set-results: Result Character Set
On the client, if no character-set-results is defined, the character-set-client character set is used as the default character set
Below share a solution to the text character garbled in MySQL solution:
Modify MySQL Configuration
Vim/etc/mysql/my.cnf
Find the "Client" item:
The Yellow keyword above is the client we are looking for, followed by adding a row below: Default-character-set=utf8
Save exit configuration file.
Then shut down the MySQL service and reboot.
/etc/init.d/mysql Stop
/etc/init.d/mysql start
Then we go into MySQL and view the character set
Mysql> Show variables like ' character\_set\_% ';
+--------------------------+--------+
| variable_name | Value |
+--------------------------+--------+
| character_set_client | utf8 |
| character_set_connection | UTF8 |
| Character_set_database | UTF8 |
| Character_set_filesystem | binary |
| Character_set_results | UTF8 |
| Character_set_server | UTF8 |
| Character_set_system | UTF8 |
+--------------------------+--------+
7 rows in Set (0.00 sec)
The above results can see the character set default support UTF8, we are involved in Chinese characters when there is no garbled situation.
The above is a small set to introduce the MySQL completely solve the problem of Chinese garbled solution (illegal mix of collations for operation), I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!