Springboot starts the connection mysql error Could not create connection to database server. Attempted reconnect 3 times. Gi

1. Error scenario : the error message is as follows

Could not create connection to database server. Attempted reconnect 3 times. Giving up.

2. Analyze the reason

This error is that mysql cannot be connected, and the mysql permission restriction does not allow remote access. The remaining 80% is that the parameters added to the mysql database connection are incorrect.

3. Solution

Set the mysql connection parameters as follows, directly copy all the following parameters to solve the problem:

jdbc:mysql://127.0.0.1:3306/base?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2B8&useSSL=false&allowPublicKeyRetrieval=true&autoReconnect=true&failOverReadOnly=false

Ssl=true is not set here, and serverTimezone needs to be set.

Summary : After setting the same parameters, 80% of the error situations can be solved. The rest may be that the mysql driver version is inconsistent with the mysql version, and the account access permissions set by mysql are not equal, so I won't discuss it here.

Guess you like

Origin blog.csdn.net/Mint6/article/details/107293567