MySQL5.6.25 in Ubuntu15.04 does not support Chinese Solutions

Source: Internet
Author: User
Tags rehash
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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.