Reasons and solutions for character error prompts in the Mysql command line interface _mysql

Source: Internet
Author: User

ERROR 2019 (HY000): Can ' t initialize character set gb2312
engaged in a very half-day, MySQL has been reloading two times, the number of tragedies ...
Before the system code was set, it was all UTF-8.

vi/etc/sysconfig/i18n 


Lang=zh_cn. UTF-8 
LANGUAGE=ZH_CN. Utf-8:zh_cn. GB2312:ZH_CN 
SUPPORTED=ZH_CN. Utf-8:zh_cn:zh:en_us. Utf-8:en_us:en 
Sysfont=lat0-sun16 

The database has also been configured UTF8

Cmake-dcmake_install_prefix=/usr/local/mysql \ 
-dmysql_unix_addr=/usr/local/mysql/mysql.sock \ 
-ddefault_charset=utf8 \ 
-ddefault_collation=utf8_ GENERAL_CI \ 
-dwith_extra_charsets:string=utf8,gbk \ 
-dwith_myisam_storage_engine=1 \ 
-DENABLED_ Local_infile=on \ 
-dwith_innobase_storage_engine=1 \ 
-dwith_readline=1 \ 
-denabled_local_infile=1 \ 
-dmysql_datadir=/var/mysql/data 

I don't know how to get a gb2312.
Looking for a long time finally found that should be the terminal input content encoding problem, remember before in order to let SSH normal display of Chinese modified

Vi/etc/profile  
Lang=zh_cn. GB2312 
Export LANG 


This place has been changed for a reason, so it's okay to comment it out and then turn off SSH relink to execute the command.

Ps:mysql Import Garbled Solution
garbled when importing, you need to add the encoding format for the specified import data in the statement:

MYSQL-UROOT-P database_name < Database_backup.sql--default-character-set=utf8

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.