### 1. 报错:"PDOException: PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]
问题原因:
1 过去mysql密码认证插件是 mysql_native_passwd
2 mysql8.0版本以后密码认证插件使用的是caching_sha2_password
办法:
修改密码认证方式,改回mysql_native_passwd插件
解决:
1 vim /etc/my.cnf添加如下内容:
[mysqld]
default_authentication_plugin=mysql_native_password
2 登录mysql执行如下sql:
ALTER USER 'yl_dw'@'%' IDENTIFIED WITH mysql_native_password BY '密码';
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '密码';
flush privileges;
注意:这里的账号和密码随实际业务情况变化而调整
### 2. 报错
2.1 create connection holder error
java.sql.SQLException: Unknown system variable 'tx_isolation'
原因:jdbc驱动是5.6的 导致数据库链接失败(mysql-connector-java-5.6.jar)
解决:
需要升级jdbc驱动jar包为(mysql-connector-java-8.0.11.jar)
jar包路径:/webser/www/FineReport/WEB-INF/lib
重启tomcat后即可
### 3. 报错:3065 - Expression #1 of ORDER BY clause is not in SELECT list, references column 'mycommunity_risesundstest.corp.user_id' which is not in SELECT list; this is incompatible with DISTINCT, Time: 0.043000s
修复:关闭严格模式
vim /etc/my.cnf
sql_mode=""
重启mysql:/etc/init.d/mysql restart即可
全局修改:需要有权限,并且不会立即生效,对以后新建的会话生效(从全局继承的)
mysql> set global sql_mode='xx_mode'
mysql> set @@global.sql_mode='xx_mode'
MySQL重启后失效
select @@sql_mode;