MySQL5.6.25 in Ubuntu15.04 does not support Chinese Solutions
MySQL 5.6.25 in Ubuntu 15.04 does not support Chinese Solutions
MySQL 5.6.25 in Ubuntu 15.04 does not support Chinese solutions. It is installed with apt-get install instead of mysql installed in the source code package.
1. Modify the mysql configuration file
/Etc/mysql/conf. d/mysql. cnf
Add the following statement below [mysql]: (Note: This file is not configured, only [mysql ])
No-auto-rehash
Default-character-set = utf8
/Etc/mysql. conf. d/mysqld. cnf
Add under [mysqld]
Socket =/var/run/mysqld. sock
Port = 3306
Character-set-server = utf8 (here it is server, some previous versions are set)
Restart mysql: sudo/etc/init. d/mysql restart
View Character Set
Mysql> show variables like '% char % ';
+ -------------------------- + ---------------------------- +
| 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 |
| Character_sets_dir |/usr/share/mysql/charsets/|
+ -------------------------- + ---------------------------- +
8 rows in set (0.00 sec)
After the settings, if the previous database has been created, you can only delete and recreate the database.
-------------------------------------- Split line --------------------------------------
The solution is summarized as follows:
1. Modify the mysql configuration file
/Etc/mysql/conf. d/mysql. cnf
Add the following statement below [mysql:
No-auto-rehash
Default-character-set = utf8
/Etc/mysql. conf. d/mysqld. cnf
Add under [mysqld]
Socket =/var/run/mysqld. sock
Port = 3306
Character-set-server = utf8 and other content, self-comparison, some do not need to add, generally only need to add character-set-server = utf8
At this time, shell enters mysql and runs: show variables like 'character % '. The result is:
Restart mysql: sudo/etc/init. d/mysql restart
Error Code: 1366. Incorrect string value: '\ xE5 \ xBC \ xA0 \ xE4 \ xB8 \ x89' for column 'ename 'at row 1
This is because the character set of the table does not support Chinese characters. Run show create table new_table to view the table creation statement.
Solution: Delete the table and create a new table. The key to supporting Chinese characters lies in the character set selected for table creation.
This article permanently updates the link address: