I can't connect to the local database even if the connection parameters are correct, using jdbc. If I try to connect by terminal or by some client i can connect.
But if I try to connect to remote database it works
this is the error:
Connected to the target VM, address: '127.0.0.1:49986', transport: 'socket'
Exception in thread "main" 2019-04-15 12:16:55 FATAL AbstractConnectorDB - Unable to connect to database jdbc:mysql://localhost:3306/my_db?autoReconnect=true&useSSL=false
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
com.mycompany.database.relational.exceptions.ConnectionFailedException: Fatal error: Unable to connect to db jdbc:mysql://localhost:3306/my_db?autoReconnect=true&useSSL=false @root
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
...
... 17 more
Disconnected from the target VM, address: '127.0.0.1:49986', transport: 'socket'
What could be the problem?