????MySQL?????????latin??????????????????????????????δutf8????????????ubuntu14??ubuntu16?????в????
?????????????my.cnf
????$sudo vim /etc/mysql/my.cnf
????[client]
????default-character-set=utf8 #????????У?????????
????port            = 3306
????socket          = /var/run/mysqld/mysqld.sock
????.............
????[mysqld]
????character_set_server=utf8 #????????У?????????
????user            = mysql
????pid-file        = /var/run/mysqld/mysqld.pid
????????????????ɡ?
????sudo /etc/init.d/mysql restart
????????????????е?database????????????utf8???
????mysql> show variables like '%char%';
????Ubuntu16?????MySQL?????
??????Ubuntu14???в???????????????????λ?ò?????????????£?
????1 ???mysql?????????
????sudo vim /etc/mysql/conf.d/mysql.cnf
??????[mysql]???·???????????????????????????????????С?mysql??)
????no-auto-rehash default-character-set=utf8
????/etc/mysql/mysql.conf.d/mysqld.cnf
??????[mysqld]?????
????socket = /var/run/mysqld/mysqld.sock port = 3306 character-set-server=utf8 ????????server?????е?汾??set??
????????mysql:
????sudo /etc/init.d/mysql restart
???????????
????mysql> show variables like '%char%';
????????????????δ???????????????????????????:?????
????mysql???????????????????? ?????????θ??? ????????????????Ч??????????????????????
????????1:
????alter database ??????? charset utf8
????????2:
????set character_set_database = utf8