mysql-5.6.23設定預設編碼為utf8方法
mysql沒有配置檔案也可以啟動,你可以把my-default.ini改名為my.ini,然後放到mysql安裝根目錄,在[mysqld]下加上character-set-server=utf8,
在[client]下加default-character-set=utf8。就可以了,哈哈。
Mysql檢視編碼方式專題
1.檢視資料庫的字符集
SHOW VARIABLES LIKE ''character_set_%'';
修改前輸出:
+--------------------------+--------+
| Variable_name | Value |
+--------------------------+--------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
+--------------------------+--------+
修改後:
+--------------------------+--------+
| 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 |
+--------------------------+--------+
2.首先檢視系統的字符集和排序方式。如果想檢視某個特定的資料庫的字符集和排序方式,應該先選定資料庫,
mysql>use databasename;
mysql> SHOW VARIABLES
LIKE "character_set_%";
改變資料庫的編碼方式
alter database databasename character set utf8;