MYSQL如何設(shè)置數(shù)據(jù)庫編碼?
(1)關(guān)閉MYSQL服務(wù)
[plain] view plaincopy
service mysql stop
(2)修改 /etc/mysql/my.cnf (默認(rèn)的安裝路徑)
[plain] view plaincopy
vim /etc/mysql/my.cnf
打開my.cnf后,在文件內(nèi)的[mysqld]下增加如下兩行設(shè)置:
[plain] view plaincopy
character_set_server=utf8
init_connect='SET NAMES utf8'
保存退出。
(3) 重新啟動(dòng)mysql服務(wù)
[plain] view plaincopy
service mysql start
至此,完成修改默認(rèn)編碼