java.sql.SQLSyntaxErrorException: Unknown database 'database name', jdbc failed to connect to the database, the table name was not found, see if this is the problem.

Everything in the code is correct, the table name is not wrong, the database and the idea software are correct, if you can’t find anything wrong, check if there is extra mysql in your computer, or the software containing mysql is starting state. Proceed as follows:

First: Right click on This PC, click Manage

Step 2: Find the service, pull down, and check that mysql or the service containing mysql is running

Step 3: Suspend the mysql you don't need. For example, if I don't need mysqlla, just stop this service, and that's it. Finally, the connection will be successful.

 The main mistake this time is that my computer has two mysql services, so I can’t use jdbc to connect to the database. This problem has occurred twice, write it down, and don’t make the same mistake in the future.

Guess you like

Origin blog.csdn.net/weixin_52435020/article/details/123906307