11

I'm working on a PHP project using PhpStorm + DataGrip + MySQL + WAMP and since then was working normally with remote database with these configurations (see images):

enter image description here

enter image description here

but suddenly I'm getting this error:

[08S01] Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. java.net.ConnectException: Connection refused: connect

enter image description here

Could someone knows what can I do to solve this error?

I already tried to do what I found here (Solving a "communications link failure" with JDBC and MySQL) and that did not work yet.

I expect to connect again normally to my database.

LazyOne
  • 158,824
  • 45
  • 388
  • 391
OUTC-K
  • 121
  • 1
  • 1
  • 8
  • If you roll back to 2019.1, does the data source still work? If so, it must be something related to the new SSH library we use. What exact 2019.2 build are you using? – Eugene Morozov Sep 12 '19 at 11:58
  • What does "Test Connection" do for you? Is this an intermittent problem? – Rogue Sep 12 '19 at 13:40
  • Guys thanks for contributions but i dicided to change the way of the db communication, right now i'm using local db instead remote one – OUTC-K Sep 19 '19 at 08:09

2 Answers2

21

Hi this error is because you are running a MySQL version 5 or 8.0 and later. And your server is configured to use the protocol of TLS 1.2. So, you need to enable TLS Protocols.

  • Open Datagrip
  • Go to Properties
  • Data Sources > Advanced

In enabledTLSProtocol set the value:

TLSv1,TLSv1.1,TLSv1.2,TLSv1.3

Test connection. And should work!

Mauricio Toledo
  • 630
  • 7
  • 10
  • Things were working for me until they stopped. I think an upgrade to PyCharm removed my values for this param. Once I added your suggestion, everything worked again. Thanks! – Ben Apr 14 '22 at 19:38
  • 1
    I needed to set the value to TLSv1.2,TLSv1.3 to get the connection to work. – SpartyDan Jun 16 '22 at 01:55
  • 1
    I also had to set `useSSL` to false in order for this to work for me – Oranges13 Aug 09 '22 at 14:43
2

edit the JDBC url and append this query parameter &enabledTLSProtocols=TLSv1.2

Rohit Funde
  • 1,080
  • 1
  • 13
  • 20