Solutions to database connection problems: “connections could not be acquired from the underlying database!”

Solutions to database connection problems: “connections could not be acquired from the underlying database!”

 

1. When learning spring security, use the correct account and password to log in successfully. When viewing user management, an error is reported

 

2. After various searches, I found that none of them could solve my problem

 

3. Later, I compared the data of “database connection pool” between projects

The problem is solved by replacing “usessl = true” in JDBC URL with “usessl = false”

 

 

 

  database.properties

1 driverClass=com.mysql.jdbc.Driver
2 jdbcUrl=jdbc:mysql://localhost:3306/ssm_order?useSSL=false&useUnicode=true&characterEncoding=utf8
3 user=root
4 password=111111

 

4. Summarize the difference between usessl = false or true:

SSL protocol provides services mainly:

1) authenticate the user server to ensure that the data is sent to the correct server; .
2) encrypt data to prevent it from being stolen and used during data transmission
3) maintain data integrity and verify whether data is lost during transmission
currently, two layers of SSL protocol are supported:
SSL record protocol: the establishment relies on the transmission protocol (TCP) high-level protocol to provide basic functions such as data encapsulation, compression and encryption. Support
SSL handshake protocol: the establishment of SSL record protocol is used for identity authentication, negotiation of encryption algorithm and Exchange encryption keys, etc

When connecting with MySQL, the higher version of MySQL needs to indicate whether to connect with SSL.

It is not recommended to establish an SSL connection without server authentication, and the explicit option must be set, because the versions after mysql5.7 default usessl = true, so you need to explicitly disable SSL by setting usessl = false;

 

Or set usessl = true and provide a trust store for server certificate validation.

 

Reference article: https://blog.csdn.net/qq_ 45151059/article/details/114297848

Similar Posts: