亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

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

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

mysql中怎么設置字符集統一

發布時間:2021-07-23 14:01:12 來源:億速云 閱讀:328 作者:Leah 欄目:數據庫

mysql中怎么設置字符集統一,針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。

一、查看 MySQL 數據庫服務器和數據庫字符集。 
 
mysql> show variables like '%char%'; 
+--------------------------+-------------------------------------+------ 
| Variable_name            | Value                               |...... 
+--------------------------+-------------------------------------+------ 
| character_set_client     | utf8                                |......   -- 客戶端字符集 
| character_set_connection | utf8                                |...... 
| character_set_database   | utf8                                |......   -- 數據庫字符集 
| character_set_filesystem | binary                              |...... 
| character_set_results    | utf8                                |...... 
| character_set_server     | utf8                                |......   -- 服務器字符集 
| character_set_system     | utf8                                |...... 
| character_sets_dir       | D:\MySQL Server 5.0\share\charsets\ |...... 
+--------------------------+-------------------------------------+------ 
二、查看 MySQL 數據表(table) 的字符集。 
 
mysql> show table status from sqlstudy_db like '%countries%'; 
+-----------+--------+---------+------------+------+-----------------+------ 
| Name      | Engine | Version | Row_format | Rows | Collation       |...... 
+-----------+--------+---------+------------+------+-----------------+------ 
| countries | InnoDB |      10 | Compact    |   11 | utf8_general_ci |...... 
+-----------+--------+---------+------------+------+-----------------+------ 
三、查看 MySQL 數據列(column)的字符集。 
 
mysql> show full columns from countries; 
+----------------------+-------------+-----------------+-------- 
| Field                | Type        | Collation       | ....... 
+----------------------+-------------+-----------------+-------- 
| countries_id         | int(11)     | NULL            | ....... 
| countries_name       | varchar(64) | utf8_general_ci | ....... 
| countries_iso_code_2 | char(2)     | utf8_general_ci | ....... 
| countries_iso_code_3 | char(3)     | utf8_general_ci | ....... 
| address_format_id    | int(11)     | NULL            | ....... 
+----------------------+-------------+-----------------+-------- 
四、查看當前安裝的 MySQL 所支持的字符集。 
 
mysql> show charset; 
mysql> show char set; 
+----------+-----------------------------+---------------------+--------+ 
| Charset | Description                 | Default collation   | Maxlen | 
+----------+-----------------------------+---------------------+--------+ 
| big5     | Big5 Traditional Chinese    | big5_chinese_ci     |      2 | 
| dec8     | DEC West European           | dec8_swedish_ci     |      1 | 
| cp850    | DOS West European           | cp850_general_ci    |      1 | 
| hp8      | HP West European            | hp8_english_ci      |      1 | 
| koi8r    | KOI8-R Relcom Russian       | koi8r_general_ci    |      1 | 
| latin1   | cp1252 West European        | latin1_swedish_ci   |      1 | 
| latin2   | ISO 8859-2 Central European | latin2_general_ci   |      1 | 
| swe7     | 7bit Swedish                | swe7_swedish_ci     |      1 | 
| ascii    | US ASCII                    | ascii_general_ci    |      1 | 
| ujis     | EUC-JP Japanese             | ujis_japanese_ci    |      3 | 
| sjis     | Shift-JIS Japanese          | sjis_japanese_ci    |      2 | 
| hebrew   | ISO 8859-8 Hebrew           | hebrew_general_ci   |      1 | 
| tis620   | TIS620 Thai                 | tis620_thai_ci      |      1 | 
| euckr    | EUC-KR Korean               | euckr_korean_ci     |      2 | 
| koi8u    | KOI8-U Ukrainian            | koi8u_general_ci    |      1 | 
| gb2312   | GB2312 Simplified Chinese   | gb2312_chinese_ci   |      2 | 
| greek    | ISO 8859-7 Greek            | greek_general_ci    |      1 | 
| cp1250   | Windows Central European    | cp1250_general_ci   |      1 | 
| gbk      | GBK Simplified Chinese      | gbk_chinese_ci      |      2 | 
| latin5   | ISO 8859-9 Turkish          | latin5_turkish_ci   |      1 | 
| armscii8 | ARMSCII-8 Armenian          | armscii8_general_ci |      1 | 
| utf8     | UTF-8 Unicode               | utf8_general_ci     |      3 | 
| ucs2     | UCS-2 Unicode               | ucs2_general_ci     |      2 | 
| cp866    | DOS Russian                 | cp866_general_ci    |      1 | 
| keybcs2 | DOS Kamenicky Czech-Slovak | keybcs2_general_ci |      1 | 
| macce    | Mac Central European        | macce_general_ci    |      1 | 
| macroman | Mac West European           | macroman_general_ci |      1 | 
| cp852    | DOS Central European        | cp852_general_ci    |      1 | 
| latin7   | ISO 8859-13 Baltic          | latin7_general_ci   |      1 | 
| cp1251   | Windows Cyrillic            | cp1251_general_ci   |      1 | 
| cp1256   | Windows Arabic              | cp1256_general_ci   |      1 | 
| cp1257   | Windows Baltic              | cp1257_general_ci   |      1 | 
| binary   | Binary pseudo charset       | binary              |      1 | 
| geostd8 | GEOSTD8 Georgian            | geostd8_general_ci |      1 | 
| cp932    | SJIS for Windows Japanese   | cp932_japanese_ci   |      2 | 
| eucjpms | UJIS for Windows Japanese   | eucjpms_japanese_ci |      3 | 
+----------+-----------------------------+---------------------+--------+ 
以上查看 MySQL 字符集命令,適用于 Windows & 。 
 
  
 
Liunx下修改MySQL字符集: 
1.查找MySQL的cnf文件的位置 
find / -iname '*.cnf' -print 
 
/usr/share/mysql/my-innodb-heavy-4G.cnf 
/usr/share/mysql/my-large.cnf 
/usr/share/mysql/my-small.cnf 
/usr/share/mysql/my-medium.cnf 
/usr/share/mysql/my-huge.cnf 
/usr/share/texmf/web2c/texmf.cnf 
/usr/share/texmf/web2c/mktex.cnf 
/usr/share/texmf/web2c/fmtutil.cnf 
/usr/share/texmf/tex/xmltex/xmltexfmtutil.cnf 
/usr/share/texmf/tex/jadetex/jadefmtutil.cnf 
/usr/share/doc/MySQL-server-community-5.1.22/my-innodb-heavy-4G.cnf 
/usr/share/doc/MySQL-server-community-5.1.22/my-large.cnf 
/usr/share/doc/MySQL-server-community-5.1.22/my-small.cnf 
/usr/share/doc/MySQL-server-community-5.1.22/my-medium.cnf 
/usr/share/doc/MySQL-server-community-5.1.22/my-huge.cnf 
 
2. 拷貝 small.cnf、my-medium.cnf、my-huge.cnf、my-innodb-heavy-4G.cnf其中的一個到/etc下,命名為my.cnf 
cp /usr/share/mysql/my-medium.cnf /etc/my.cnf 
 
3. 修改my.cnf 
vi /etc/my.cnf 
在[client]下添加 
default-character-set=utf8
在[mysqld]下添加 
default-character-set=utf8
 
4.重新啟動MySQL 
[root@bogon ~]# /etc/rc.d/init.d/mysql restart 
Shutting down MySQL                                         [ 確定 ] 
Starting MySQL.                                           [ 確定 ] 
[root@bogon ~]# mysql -u root -p 
Enter 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. 
 
其他的一些設置方法: 
 
修改的字符集 
>use mydb 
mysql>alter database mydb character set utf-8; 
創建數據庫指定數據庫的字符集 
mysql>create database mydb character set utf-8; 
 
通過配置文件修改: 
修改/var/lib/mysql/mydb/db.opt 
default-character-set=latin1
default-collation=latin1_swedish_ci
為 
default-character-set=utf8
default-collation=utf8_general_ci
重起MySQL: 
[root@bogon ~]# /etc/rc.d/init.d/mysql restart 
 
通過MySQL命令行修改: 
mysql> set character_set_client=utf8; 
Query OK, 0 rows affected (0.00 sec) 
mysql> set character_set_connection=utf8; 
Query OK, 0 rows affected (0.00 sec) 
mysql> set character_set_database=utf8; 
Query OK, 0 rows affected (0.00 sec) 
mysql> set character_set_results=utf8; 
Query OK, 0 rows affected (0.00 sec) 
mysql> set character_set_server=utf8; 
Query OK, 0 rows affected (0.00 sec) 
mysql> set character_set_system=utf8; 
Query OK, 0 rows affected (0.01 sec) 
mysql> set collation_connection=utf8; 
Query OK, 0 rows affected (0.01 sec) 
mysql> set collation_database=utf8; 
Query OK, 0 rows affected (0.01 sec) 
mysql> set collation_server=utf8; 
Query OK, 0 rows affected (0.01 sec) 

關于mysql中怎么設置字符集統一問題的解答就分享到這里了,希望以上內容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注億速云行業資訊頻道了解更多相關知識。

向AI問一下細節

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

AI

邛崃市| 渑池县| 彰武县| 新绛县| 卫辉市| 新宁县| 大渡口区| 南丹县| 宜丰县| 梨树县| 班戈县| 保德县| 鹤山市| 威信县| 突泉县| 闽清县| 柳江县| 白玉县| 图木舒克市| 磐安县| 陆川县| 会昌县| 固镇县| 兴化市| 五原县| 杭锦旗| 黄大仙区| 从江县| 揭阳市| 勃利县| 临汾市| 台中市| 大悟县| 博客| 古蔺县| 齐齐哈尔市| 北安市| 兴义市| 长岭县| 永宁县| 正阳县|