mysql5.1上成功更改的例子:
以下是详细过程
mysql> usemysql
Database changed
mysql> CREATETABLE pingfen
Query OK, 0 rows affected(0.02 sec)
mysql> insertinto table pingfen(zonghepingfen,duanqi)values(6,'你好');
Aborted
[root@master yum.repos.d]#mysql -uroot
Welcome to the MySQLmonitor.
Your MySQL connection id is4
Server version: 5.1.71 Sourcedistribution
Copyright (c) 2000, 2013,Oracle and/or its affiliates. All rights reserved.
Oracle is a registeredtrademark of Oracle Corporation and/or its
affiliates. Other names may betrademarks of their respective
owners.
Type 'help;' or '\h' for help.Type '\c' to clear the current input statement.
mysql> usemysql mysql
Database changed
mysql> insertinto
Query OK, 1 row affected, 1warning (0.01 sec)
mysql> select *from pingfen;
------ ---------------------------- --------- ------- ------- -------- -------- ------------------- -------- --------- --------- --------------------------- -----------
| CODE | ZONGHEPINGFEN |DATE_INSERT | NEIRONG | JISHU | ZIJIN | XIAOXI | HANGYE | JIBEN |PAIXU_TIPS | DUANQI | ZHONGQI | CHANGQI | CHENGBEN |CHENGBENMIAOSHU | WURIZIJIN |
------ ---------------------------- --------- ------- ------- -------- -------- ------------------- -------- --------- --------- --------------------------- -----------
| NULL|
------ ---------------------------- --------- ------- ------- -------- -------- ------------------- -------- --------- --------- --------------------------- -----------
1 row in set (0.00sec)
mysql> setnames utf8;
Query OK, 0 rows affected(0.00 sec)
mysql> select *from pingfen;
------ ---------------------------- --------- ------- ------- -------- -------- ------------------- -------- --------- --------- --------------------------- -----------
| CODE | ZONGHEPINGFEN |DATE_INSERT | NEIRONG | JISHU | ZIJIN | XIAOXI | HANGYE | JIBEN |PAIXU_TIPS | DUANQI | ZHONGQI | CHANGQI | CHENGBEN |CHENGBENMIAOSHU | WURIZIJIN |
------ ---------------------------- --------- ------- ------- -------- -------- ------------------- -------- --------- --------- --------------------------- -----------
| NULL|
------ ---------------------------- --------- ------- ------- -------- -------- ------------------- -------- --------- --------- --------------------------- -----------
1 row in set (0.00sec)
mysql> selectduanqi from pingfen;
--------
| duanqi |
--------
|
--------
1 row in set (0.00sec)
mysql> insertinto
Query OK, 1 row affected, 1warning (0.01 sec)
mysql>commit;
Query OK, 0 rows affected(0.00 sec)
mysql> selectduanqi from pingfen;
--------
| duanqi |
--------
|
|
--------
2 rows in set (0.00sec)
mysql> setnames gbk;
Query OK, 0 rows affected(0.00 sec)
mysql> selectduanqi from pingfen;
--------
| duanqi |
--------
|
|
--------
2 rows in set (0.00sec)
mysql> altertable pingfen character set gbk;
Query OK, 2 rows affected(0.07 sec)
Records: 2
mysql> selectduanqi from pingfen;
--------
| duanqi |
--------
|
|
--------
2 rows in set (0.00sec)
mysql> insertinto
Query OK, 1 row affected (0.01sec)
mysql> selectduanqi from pingfen;
------------------------
|duanqi
------------------------
|
|
|
------------------------
3 rows in set (0.00sec)
mysql>