The Cause and solution of the character error prompt on the MySQL command line interface.

Source: Internet
Author: User
Tags php error mysql command line mysql import

The Cause and solution of the character error prompt on the MySQL command line interface.

ERROR 2019 (HY000): Can't initialize character set gb2312
After a long time, MySQL has been reinstalled twice. The tragedy of the No...
All the system code is 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 been configured with 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 generate a gb2312.
After searching for a long time, I finally found out that the terminal entered the content encoding problem. I remembered that I had modified it to make SSH display Chinese normally.

vi /etc/profile  
LANG=zh_CN.GB2312 export LANG 


The reason for the modification is as follows: comment it out and shut down the ssh relink, and then execute the command,

PS: MySQL import garbled Solution
Garbled characters occur during import. You must add the encoding format of the specified imported data to the statement:

mysql -uroot -p database_name < database_backup.sql --default-character-set=utf8

Articles you may be interested in:
  • MySQL master-slave replication steps and common error Solutions
  • Errors During Mysql installation and Solutions
  • PHP error Warning: mysql_query () Solution
  • Mysql is caused by a common ERROR 1135 (HY000) ERROR.
  • I would like to share some common Mysql errors and solutions.
  • Solutions to errors related to PID file loss in MySQL
  • MySQL SQL script import error: 2006 Solution
  • MySQL savepoint statement errors
  • MySQL ERROR 1615 Solution
  • Two solutions for MySQL error Forcing close of thread

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.