necessary to change only the client and connection and
results settings. There is a simple statement which changes
all three at once:
SET NAMES
. Forexample:
mysql> SHOW VARIABLES LIKE 'char%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
mysql> SET NAMES 'big5'; //使用後
Query OK, 0 rows affected (0.00 sec)
mysql> status;
--------------
mysql Ver 14.14 Distrib 5.1.54, for debian-linux-gnu (x86_64) using readline 6.2
Connection id: 37
Current database: testdb
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.1.54-1ubuntu4 (Ubuntu)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: big5
Conn. characterset: big5
UNIX socket: /var/run/mysqld/mysqld.sock
Uptime: 7 hours 50 min 7 sec
Threads: 1 Questions: 606 Slow queries: 0 Opens: 115 Flush tables: 1 Open tables: 27 Queries per second avg: 0.21
--------------
mysql> SHOW VARIABLES LIKE 'char%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | big5 |
| character_set_connection | big5 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | big5 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
Reference:
http://dev.mysql.com/doc/refman/5.0/en/faqs-cjk.html
0 意見:
張貼留言