设置了表的默认字符集为utf8并且通过UTF-8编码发送查询,存入数据库的仍然是乱码。那connection连接层上可能出了问题。解决方法是在发送查询前执行一下下面这句: SET NAMES 'utf8';它相当于下面的三句指令:
SET character_set_client = utf8; SET character_set_results = utf8; SET character_set_connection = utf8;--------------------------------------分割线 --------------------------------------
Ubuntu 14.04下安装MySQL