小结下MySQL中文乱码,phpmyadmin乱码,php乱码 产生原因及其解决方法第1/3页

时间:2021-05-18

乱码产生原因

mysql字符编码是版本4.1引入的,支持多国语言,而且一些特性已经超过了其他的数据库系统。

我们可以在MySQLCommandLineClient下输入如下命令查看mysql的字符集

mysql>SHOWCHARACTERSET;
+----------+-----------------------------+---------------------+--------+
|Charset|Description|Defaultcollation|Maxlen|
+----------+-----------------------------+---------------------+--------+
|big5|Big5TraditionalChinese|big5_chinese_ci|2|
|dec8|DECWestEuropean|dec8_swedish_ci|1|
|cp850|DOSWestEuropean|cp850_general_ci|1|
|hp8|HPWestEuropean|hp8_english_ci|1|
|koi8r|KOI8-RRelcomRussian|koi8r_general_ci|1|
|latin1|cp1252WestEuropean|latin1_swedish_ci|1|
|latin2|ISO8859-2CentralEuropean|latin2_general_ci|1|
|swe7|7bitSwedish|swe7_swedish_ci|1|
|ascii|USASCII|ascii_general_ci|1|
|ujis|EUC-JPJapanese|ujis_japanese_ci|3|
|sjis|Shift-JISJapanese|sjis_japanese_ci|2|
|hebrew|ISO8859-8Hebrew|hebrew_general_ci|1|
|tis620|TIS620Thai|tis620_thai_ci|1|
|euckr|EUC-KRKorean|euckr_korean_ci|2|
|koi8u|KOI8-UUkrainian|koi8u_general_ci|1|
|gb2312|GB2312SimplifiedChinese|gb2312_chinese_ci|2|
|greek|ISO8859-7Greek|greek_general_ci|1|
|cp1250|WindowsCentralEuropean|cp1250_general_ci|1|
|gbk|GBKSimplifiedChinese|gbk_chinese_ci|2|
|latin5|ISO8859-9Turkish|latin5_turkish_ci|1|
|armscii8|ARMSCII-8Armenian|armscii8_general_ci|1|
|utf8|UTF-8Unicode|utf8_general_ci|3|
|ucs2|UCS-2Unicode|ucs2_general_ci|2|
|cp866|DOSRussian|cp866_general_ci|1|
|keybcs2|DOSKamenickyCzech-Slovak|keybcs2_general_ci|1|
|macce|MacCentralEuropean|macce_general_ci|1|
|macroman|MacWestEuropean|macroman_general_ci|1|
|cp852|DOSCentralEuropean|cp852_general_ci|1|
|latin7|ISO8859-13Baltic|latin7_general_ci|1|
|cp1251|WindowsCyrillic|cp1251_general_ci|1|
|cp1256|WindowsArabic|cp1256_general_ci|1|
|cp1257|WindowsBaltic|cp1257_general_ci|1|
|binary|Binarypseudocharset|binary|1|
|geostd8|GEOSTD8Georgian|geostd8_general_ci|1|
|cp932|SJISforWindowsJapanese|cp932_japanese_ci|2|
|eucjpms|UJISforWindowsJapanese|eucjpms_japanese_ci|3|
+----------+-----------------------------+---------------------+--------+
36rowsinset(0.02sec)

更多mysql的字符集知识可以参考本论坛的
http://mandLineClient创建数据库】

mysql>CREATETABLE`mysqlcode`(
->`id`TINYINT(255)UNSIGNEDNOTNULLAUTO_INCREMENTPRIMARYKEY,
->`content`VARCHAR(255)NOTNULL
->)TYPE=MYISAMCHARACTERSETgbkCOLLATEgbk_chinese_ci;
QueryOK,0rowsaffected,1warning(0.03sec)
123下一页阅读全文

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章