Analysis of MYSQL Chinese input in Ubuntu
BitsCN.com
MYSQL in Ubuntu is installed with apt-get, and the configuration process is skipped. Therefore, Chinese characters cannot be entered by default. 1. find the cnf file location of MySQL.
Find/-iname '*. cnf '-print/etc/ssl/openssl. cnf/etc/mysql/debian. cnf/etc/mysql/conf. d/mysqld_safe_syslog.cnf/etc/mysql/my. cnf/usr/share/doc/mysql-server-5.1/examples/my-small.cnf/usr/share/ssl-cert/ssleay. cnf/usr/lib/ssl/openssl. cnf 2. directly configure/etc/mysql/my. cnf file 3. modify my. cnf
Vi/etc/my. cnf add default-character-set = utf8 under [client] add default-character-set = utf8 under [mysqld] 4. restart MySQL
[Root @ bogon ~] # Sudo/etc/init. d/mysql restartShutting down MySQL [OK] Starting MySQL. [OK] [root @ bogon ~] # Mysql-u root-pEnter password: Welcome to the MySQL monitor. commands end with; or/g. your MySQL connection id is 1 Server version: 5.1.22-rc-community-log MySQL Community Edition (GPL) Type 'help; 'or'/h' for help. type '/C' to clear the buffer. 5. view character set settings
Mysql> show variables like 'collation _ % '; + rows + --------------- + | Variable_name | Value | + rows + --------------- + | collation_connection | rows | collation_database | rows | collation_server | rows | + rows + 3 rows in set (0.02 sec) mysql> show variables like 'character _ set _ % '; + bytes + | Variable_name | Value | + bytes + | character_set_client | utf8 | character_set_connection | utf8 | character_set_database | utf8 | bytes | binary | utf8 | | character_set_server | utf8 | character_set_system | utf8 | character_sets_dir |/usr/share/mysql/charsets/| + ---------------------- + rows + 8 rows in set (0.02 sec) mysql> Author: ChanthonbitsCN.com