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

相關文章
相關標籤/搜索