在hibernate.cfg.xml文件中链接属性加入url参数:<property name="connection.url"> jdbc:mysql://localhost:3306/dbname?useUnicode=true&characterEncoding=utf-8</property>