egg啟動時,報錯:Ignoring invalid timezone passed to Connection的解決方案
阿新 • • 發佈:2022-03-20
報錯資訊
Ignoring invalid timezone passed to Connection: +8:00. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection
分析問題
大致意思是:這個時區的設定是無效的,但是忽略了這個無效(也就是現在也能用)。現在是一個警告,以後的版本就會丟擲一個錯誤了。
解決方案
看到網上很多解決方案是啟動的時候新增:--ignore-stderr (忽視錯誤資訊)
"start": "egg-scripts start --daemon --title=egg-server-diary",
"start-pro": "egg-scripts start --daemon --title=egg-server-diary --ignore-stderr",
這樣做能用,但是沒有解決根本問題。
導致這個問題的根源是egg-sequelize連線資料庫的配置中timezone的格式錯誤。
正確的格式應該是:
+/- HH:mm
錯誤寫法:
timezone:'+8:00'
正確寫法:
timezone:'+08:00'
就少了一個0,引起的錯誤。