Before restarting the computer, everything worked fine. After the restart, netbeans writes an error when compiling the project

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

NetBeans sees my database tables, but it still kicks the error out. Although the database works fine in WorkBench, requests are sent and received

Here is the code with which I connect to the database

Class.forName("com.mysql.cj.jdbc.Driver").getDeclaredConstructor().newInstance(); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/sys?autoReconnect=true&useSSL=false", "root", "root"); 

jar driver file in the project I added
jar file

MySQL server] Driver jdbc

    1 answer 1

    Look in services (Win10) and check if your MySQL service is running. enter image description here

    If not, start and the next connection should be successful.

    • The process was launched, still netbeans does not work - Maxim Blizhnikau