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

Recommend

Use tomcat to set shared lib to share the same jar

As more and more projects are deployed, more and ...

How to mount a data disk on Tencent Cloud Server Centos

First, check whether the hard disk device has a d...

Detailed tutorial on deploying Springboot or Nginx using Kubernetes

1 Introduction After "Maven deploys Springbo...

The magic of tbody tag speeds up the display of table content

You must have saved other people’s web pages and l...

Linux debugging tools that developers and operators must look at [Recommended]

System performance expert Brendan D. Gregg update...

Docker completely deletes private library images

First, let’s take a look at the general practices...

Automatically install the Linux system based on cobbler

1. Install components yum install epel-rpm-macros...

Detailed explanation of the steps to build a Vue project with Vue-cli

First you need to install Vue-cli: npm install -g...

Summary of commonly used performance test scripts for VPS servers

Here is a common one-click performance test scrip...

SQL implementation of LeetCode (175. Joining two tables)

[LeetCode] 175.Combine Two Tables Table: Person +...

Example of using rem to replace px in vue project

Table of contents tool Install the plugin Add a ....

Implementation of tomcat deployment project and integration with IDEA

Table of contents 3 ways to deploy projects with ...

Docker volume deletion operation

prune To use this command, both the client and da...

Good website copywriting and good user experience

Looking at a website is actually like evaluating a...