### 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;