JDBC链接错误(Illegal mix of collations。。。)

一、链接java和mysql时出现了这样的报错:java

java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT)mysql

and (utf8_general_ci,COERCIBLE) for operation '='sql

解决方法:在mysql命令下执行:ALTER DATABASE mybatisdb DEFAULT CHARACTER SET utf8 COLLATE utf8_binmybatis

,而后从新建表就能够了。ide

二、java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)spa

解决方法:grant all privileges on *.* to 'root'@'127.0.0.1' identified by '密码';   而后flush privileges; ci

相关文章
相关标签/搜索