IDEA reports an error when connecting to MySQL! Server returns invalid timezone. Go to tab and set serverTimezone property

IDEA reports an error when connecting to MySQL! Server returns invalid timezone. Go to tab and set serverTimezone property

The road ahead is always so difficult and full of thorns. Grit your teeth and believe that you can get through it. Come on, come on!

Error screen

IDEA connects to MySQL, the address, username, password, and database name are all configured. Click test connection. Click! unsuccessful!

The interface is like this,

Translated: The server returned an invalid time zone. Go to the Advanced tab and manually set the serverTimezone property.

Looks like there's a time zone issue. How can time zones be a problem? There are so many pitfalls. I searched for various solutions online and there were so many, some complex and some simple, but I finally solved it!

Solution

My problem lies in two parts. First, setting the time zone of MySQL. Second, the version of MySQL driver. The detailed steps are as follows:

First, set the MySQL time zone.

1. Let's check the MySQL time zone first.

(Here is a little episode~~~~~~~Have you configured the environment variables for your mysql?)

After configuring the environment variables, you can execute the following commands directly in the command window!

Enter the command window (Win + R), connect to the database mysql -hlocalhost -uroot -p, press Enter, enter the password, and press Enter, as shown in the figure:

2. Continue to enter show variables like'%time_zone'; (be careful not to miss the semicolon at the end), and press Enter, as shown in the figure:

If it shows SYSTEM, it means that the time zone is not set.

3. Now let's set the time zone.

Enter set global time_zone = '+8:00'; be careful not to miss the semicolon at the end), and press Enter, as shown in the figure:

This is a successful setup!

At this time, you can reconnect to the database and maybe it will be successful! If not, keep going!

Second, synchronize the MySQL driver.

The MySQL version installed on my computer is 5.7, so IDEA should also match the driver version to connect to MySQL. Just change the Driver to MySQL for 5.1

Click Test Connection to test, success!

【Replenish】

If you choose MySQL,

It doesn't matter if the database is of another version.

Find MySQL in the driver list, select the version you need in Driver files on the right, and save it.

Summarize

This is an article about IDEA connecting to MySQL and reporting an error! Server returns invalid timezone. Go to 'Advanced' tab and set 'serverTimezone' property This is the end of the article. For more related idea connection mysql error content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Tutorial on return and goto statements used for jumps in C++ flow control
  • Golang return omitted usage instructions
  • Python Django view two ways to implement return
  • return statement in go language

<<:  Solve the problems that need to be paid attention to when configuring Tomcat's maxPostSize attribute

>>:  Vue+echart realizes double column chart

Blog    

Recommend

JavaScript explains the encapsulation and use of slow-motion animation

Implementing process analysis (1) How to call rep...

Detailed use cases of vue3 teleport

Official Website https://cli.vuejs.org/en/guide/ ...

Detailed explanation of two points to note in vue3: setup

Table of contents In vue2 In vue3 Notes on setup ...

Multiple ways to insert SVG into HTML pages

SVG (Scalable Vector Graphics) is an image format...

Detailed steps for installing and configuring MySQL 8.0 on CentOS 7.4 64-bit

Step 1: Get the MySQL YUM source Go to the MySQL ...

How to upgrade all Python libraries in Ubuntu 18.04 at once

What is pip pip is a Python package management to...

Use viewport in meta tag to define screen css

<meta name="viewport" content="w...

Let’s talk in detail about how browsers view closures

Table of contents Preface Introduction to Closure...

CentOS server security configuration strategy

Recently, the server has been frequently cracked ...

How to upgrade https under Nginx

Purchase Certificate You can purchase it from Ali...