中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

mysql中文字符的問題怎么處理

發布時間:2021-11-06 10:38:51 來源:億速云 閱讀:271 作者:小新 欄目:MySQL數據庫

這篇文章主要介紹mysql中文字符的問題怎么處理,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

mysql中文字符的問題
mysql5.1上成功更改的例子:      
      1.
my.cnfclentmysqld加入default-character-set=utf8

      2.  更改數據庫字符集

      3.創建數據庫表字符集

      4.更改兼容中文的gbk

以下是詳細過程

 

mysql> use mysql

Database changed

mysql> CREATE TABLE pingfen

    ->    (CODE VARCHAR(20),

    -> ZONGHEPINGFEN Decimal(12,3),

    -> DATE_INSERT DATEtime,

    -> NEIRONG LONGTEXT,

    -> JISHU Decimal(12,3),

    -> ZIJIN Decimal(12,3),

    -> XIAOXI Decimal(12,3),

    -> HANGYE Decimal(12,3),

    -> JIBEN Decimal(12,3),

    -> PAIXU_TIPS Decimal(12,3),

    -> DUANQI VARCHAR(100),

    -> ZHONGQI VARCHAR(100),

    -> CHANGQI VARCHAR(100),

    -> CHENGBEN Decimal(12,3),

    -> CHENGBENMIAOSHU VARCHAR(500),

    -> WURIZIJIN VARCHAR(100)

    ->    ) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8;

Query OK, 0 rows affected (0.02 sec)

 

mysql> insert into table pingfen(zonghepingfen,duanqi) values(6,'你好');

    '> ;

    '> ;

    '> /

    '> ;

    '> exit

    '> exit;

    '> by;

    '> Ctrl-C -- exit!

Aborted

[root@master yum.repos.d]# mysql -uroot

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 4

Server version: 5.1.71 Source distribution

 

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

 

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

mysql> use mysql mysql

Database changed

mysql> insert into  pingfen(zonghepingfen,duanqi) values(6,'你好');

Query OK, 1 row affected, 1 warning (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 |         6.000 | NULL        | NULL    |  NULL |  NULL |   NULL |   NULL |  NULL |       NULL |        | NULL    | NULL    |     NULL | NULL            | NULL      |

+------+---------------+-------------+---------+-------+-------+--------+--------+-------+------------+--------+---------+---------+----------+-----------------+-----------+

1 row in set (0.00 sec)

 

mysql> set names 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 |         6.000 | NULL        | NULL    |  NULL |  NULL |   NULL |   NULL |  NULL |       NULL |        | NULL    | NULL    |     NULL | NULL            | NULL      |

+------+---------------+-------------+---------+-------+-------+--------+--------+-------+------------+--------+---------+---------+----------+-----------------+-----------+

1 row in set (0.00 sec)

 

mysql> select duanqi from pingfen;

+--------+

| duanqi |

+--------+

|        |

+--------+

1 row in set (0.00 sec)

 

mysql> insert into  pingfen(zonghepingfen,duanqi) values(6,'你好111111111111111111');

Query OK, 1 row affected, 1 warning (0.01 sec)

 

mysql> commit;

Query OK, 0 rows affected (0.00 sec)

 

mysql> select duanqi from pingfen;

+--------+

| duanqi |

+--------+

|        |

|        |

+--------+

2 rows in set (0.00 sec)

 

mysql> set names gbk;

Query OK, 0 rows affected (0.00 sec)

 

mysql> select duanqi from pingfen;

+--------+

| duanqi |

+--------+

|        |

|        |

+--------+

2 rows in set (0.00 sec)

 

mysql> alter table pingfen character set gbk;    更改兼容中文的gbk

Query OK, 2 rows affected (0.07 sec)

Records: 2  Duplicates: 0  Warnings: 0

 

mysql> select duanqi from pingfen;

+--------+

| duanqi |

+--------+

|        |

|        |

+--------+

2 rows in set (0.00 sec)

 

mysql> insert into  pingfen(zonghepingfen,duanqi) values(6,'你好111111111111111111');

Query OK, 1 row affected (0.01 sec)

 

mysql> select duanqi from pingfen;

+------------------------+

| duanqi                 |

+------------------------+

|                        |

|                        |

| 你好111111111111111111     |

+------------------------+

3 rows in set (0.00 sec)

 

mysql>

以上是“mysql中文字符的問題怎么處理”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注億速云行業資訊頻道!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

崇明县| 方山县| 浮梁县| 封开县| 文昌市| 固阳县| 建瓯市| 卢龙县| 井研县| 疏勒县| 托克托县| 上高县| 保康县| 昌宁县| 安宁市| 莎车县| 舟曲县| 苗栗县| 都江堰市| 阜康市| 那坡县| 芦溪县| 西乌| 石门县| 阿拉善右旗| 周宁县| 平乡县| 西安市| 沅陵县| 昌图县| 思南县| 阳原县| 江西省| 萨迦县| 蛟河市| 微山县| 黄陵县| 泽普县| 南通市| 长乐市| 鄢陵县|