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