Ubuntu under the fix MySQL insert Chinese garbled (???? ) problems

Source: Internet
Author: User
Tags mysql insert

I. Causes

MyEclipse inserted in Chinese found not only in MySQL and in the MyEclipse query are displayed???


? Two. Resolve ?

Online read a lot of information, if in MySQL directly modify, restart MySQL after the failure, general modification My.ini file, of course, under Ubuntu is my.cnf. The process of modification can be referred to http://blog.knowsky.com/190431.htm

But in the course of my modifications, I found:

Find [mysqld] below to join
Default-character-set=utf8
init_connect= ' SET NAMES UTF8 '

       Once the Mysqlid is modified, it will be error to start MySQL again: Error 2002 (HY000): Can ' t connect to local MySQL server through socket '/var/run/mysqld /mysqld.sock '

Find a lot of methods, are not very effective, I instead in a modification my.cnf accidentally deleted all the files, have to reinstall MySQL

By the way, introduce how and reload MySQL


Three. mysql Reload

See http://www.jbxue.com/db/14719.html for more details


? Four. Continue to solve garbled problems ?

Installation complete, view current encoding settings

|character_set_client      | utf8                                    | |  character_set_connection | utf8                                    | |  character_set_database   | utf8                                    | |  character_set_filesystem | binary                                  | |  character_set_results    | utf8                                    | |  character_set_server     | latin1                                  | |  character_set_system     | utf8

Found

Character_set_server

Or latin1 reason to find, the following to solve, the original reason for this ~

The others are the same as above, only added under [Mysqld]

Default-character-set=utf8

Switch

Character-set-server=utf8


Try to modify

Enter command sudo service mysql restart to restart MySQL and start successfully! Then look at the code:

+--------------------------+----------------------------+ | 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                        |

Run JUnit test again, insert Chinese success!!!

Ubuntu under the fix MySQL insert Chinese garbled (???? ) problems

Related Article

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.