首頁 >資料庫 >mysql教程 >linux下的mysql修改默认编码_MySQL

linux下的mysql修改默认编码_MySQL

WBOY
WBOY原創
2016-06-01 13:13:33804瀏覽

安装mysql
sudo apt-get install mysql-server
查看mysql默认编码
show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
修改mysql的默认编码
sudo gedit /etc/mysql/my.cnf

在[mysqld]
#
# * Basic Settings
#
下面加上
character_set_server=utf8


修改完成后保存然后重启mysql
sudo /etc/init.d/mysql restart
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn