Database-Connect to the database with IDEA

Database-Connect to the database with IDEA

Connection method: Use IDEA's own DATABASE plug-in

First open the database tool window from the menu View→Tool Windows→Database, as shown in the following figure: The subsequent operations are similar to Database Navigato

Insert picture description here

IDEA does not have its own DATABASE

1. Install the Database Navigato plugin

Insert picture description here
2. Connect to the database (take MySQL as an example)

Insert picture description here
3. After the connection is successful, Navigate will appear at the top, and DB Browser will appear on the left, and then click DB Browser on the left

Insert picture description here
4. Write SQL statements

Click the seventh button on the left, new consoles (note that the database to be operated is selected)

Insert picture description here

Solve the time zone problem when connecting (The server time zone)

Method 1: Add serverTimezone=GMT%2B8 to the properties configuration file

serverTimezone=GMT%2B8
url=jdbc:mysql://localhost:3306/jdbcstudy?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&useSSL=false

**方式二:打开命令行,设置MySQL时区为当前系统时区**

![在这里插入图片描述](https://img-blog.csdnimg.cn/20201022181613174.png#pic_center)


**方式三:修改MySQL配置文件my.ini**

在文件里加上  **default-time-zone='+08:00'**

![在这里插入图片描述](https://img-blog.csdnimg.cn/20201022181626338.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dwYzIwMTg=,size_16,color_FFFFFF,t_70#pic_center)

Guess you like

Origin blog.csdn.net/wpc2018/article/details/109227667