mysql 修改字符集
生活随笔
收集整理的這篇文章主要介紹了
mysql 修改字符集
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
轉(zhuǎn)自:http://www.cnblogs.com/dadadechengzi/p/6034212.html
查看mysql數(shù)據(jù)編碼
登錄MySQL服務,查看mysql數(shù)據(jù)庫默認的編碼
mysql> show variables like 'character%'; +--------------------------+-------------------------------------------------+ | Variable_name | Value | +--------------------------+-------------------------------------------------+ | character_set_client | gbk | | character_set_connection | gbk | | character_set_database | latin1 | | character_set_filesystem | binary | | character_set_results | gbk | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | E:\0Develop\mysql-5.7.15-winx64\share\charsets\ | +--------------------------+-------------------------------------------------+ 8 rows in set, 1 warning (0.00 sec) mysql>可以看出database和server都采用了latin1編碼,不支持中文,我們需要把它修改為utf-8。
除了這兩個,其它的如下
| 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 | E:\0Develop\mysql-5.7.15-winx64\share\charsets\設置mysql數(shù)據(jù)庫編碼
在mysql安裝目錄下,將 my-default.ini 復制一分保存為 my.ini?
做如下修改?
主要看紅色框里的內(nèi)容
[mysqld] character-set-server=utf8 collation-server=utf8_general_ci [mysql] default-character-set = utf8 [mysql.server] default-character-set = utf8 [mysqld_safe] default-character-set = utf8 [client] default-character-set = utf8然后刪除你當前的mysql服務,再重新注冊mysql服務?
注:一定要以管理員的權(quán)限運行dos命令,且cd到mysql安裝目錄下的bin目錄,再注冊mysql服務
結(jié)果
啟動服務,查看編碼
C:\Windows\System32>net start mysql mysql 服務正在啟動 . mysql 服務已經(jīng)啟動成功。C:\Windows\System32>mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.15 MySQL Community Server (GPL)Copyright (c) 2000, 2016, 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> show variables like 'character%'; +--------------------------+-------------------------------------------------+ | 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 | E:\0Develop\mysql-5.7.15-winx64\share\charsets\ | +--------------------------+-------------------------------------------------+ 8 rows in set, 1 warning (0.00 sec) mysql>轉(zhuǎn)載于:https://www.cnblogs.com/ow0843/p/9829557.html
總結(jié)
以上是生活随笔為你收集整理的mysql 修改字符集的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 004-2-拟合,drop-out
- 下一篇: Android开发 - 设置Dialog