關於“Cannot resolve table 'user'”報錯及運行日志報java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone的問題解決


  springboot+vue建立映射時,后端引用@Table(name=“user”) 來對應表名 user,但引用后報錯“Cannot resolve table 'user'”,嘗試了多篇博主的博文后,問題解決,現在總結一下各位大佬的方法:

 

第一:View-->Tool windows-->Database-->Data Source-->MySQL輸入Host、Port和賬號密碼進行測試

 

 

 

 

 

 如果報Server returns invalid timezone. Need to set 'serverTimezone' property.在URL后綴加上?serverTimezone=GMT%2B8

 

 

測試成功后,Apply后點擊OK

 

 

第二:View-->Tool windows-->Persistence后雙擊“entityManagerFactory”右鍵選擇Assign Data Sources加載剛才建的Database

 

 

 

 

 

 上述兩步執行后還報“Cannot resolve table 'user'”的話,嘗試以下操作File-->Settings-->Editor-->Code Style-->Inspections取消JPA的勾選框。

 

 

 

在后端工程運行中如果報“java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.”,在application.properties配置文件的spring.datasource.url的值后邊加上

?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC,如圖:

 

 

 
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM