springboot mysql數據庫操作實例
啟動項目時,出現如下報錯:
The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone.
解決方案:
使用root用戶后台登錄mysql數據庫:
>mysql -u root -p
Enter password: *********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2109
Server version: 5.7.22-log MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show variables like '%time_zone%';
mysql> set global time_zone='+8:00';
退出后,重新登錄數據庫查詢時區,即更正成功。
重啟springboot項目后,啟動成功。
登錄數據庫,查詢創建的實體表person。
person表創建成功。
查看person表結構: