mysql解决乱码问题
进入mysql(mysql -u root -p),查看当前数据库字符集(status;)
刚开始是latin1,所以乱码。
vim /etc/my.cnf
两个节点添加如下:
[client]
default-character-set=utf8
[mysqld]
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci
关闭mysql服务
/etc/init.d/mysqld stop
重新启动mysql服务
/etc/init.d/mysqld start
查看字符集
show variables like '%character%';
永久改成功了。。。。
Face your past without regret. Handle your present with confidence.Prepare for future without fear. keep the faith and drop the fear.
面对过去无怨无悔,把握现在充满信心,备战未来无所畏惧。保持信念,克服恐惧!一点一滴的积累,一点一滴的沉淀,学技术需要不断的积淀!