简体   繁体   中英

How to close connection to a remote MySQL database?

I was testing my SpringBoot app which connects to a remote SQL database. I was also using MySQL workbench to view the tables. Then when I tried to run my app, it gave an error message as follows:

Data source rejected establishment of connection, message from server: "Too many connections"

I have tried restarting my PC but it still gives the same error. How can I solve it? I believe the previous connection was not properly closed. What can I do now?

The connections are automatically closed (or return to the connection pool) if you are using Spring Data Repository or JdbcTemplate. Your application may really need too many connections compared to your database limit, in that case you should check your database configuration. You can also check your connection properties in application.properties (pool size, idle time, timeout). Please add more details like code or configuration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM