MySQL數據庫支持多種字符集,有時候我們需要變更字符集以滿足需要,操作方法如下:
(01)登錄MySQLmysql -u root -p
(02)查看MySQL中有哪些數據庫show databases;我們選用cmsuse cms;查看cms數據庫當前的字符集show variables like 'character_set_database';
(03)顯現,需要把gb2313換成utf8alter database cms character set 'utf8';
(04)查看cms數據庫當前的字符集。show variables like 'character_set_database';
(05)使用 show char set; 查看當前MySQL支持的所有字符集,以便選擇你需要的。