java.sql.SQLSyntaxErrorException: Unknown database ‘***‘

        Changed the article to record a pit that I encountered recently when developing a large-scale e-commerce platform.

        The problem mainly comes from the connection to the database. First, after modifying the url in the application-dev.yml configuration file under resource and connecting to the database, I found that the error described in the title was reported. Then I thought that IDEA did not connect to the database before reporting the error. , so manually associate IDEA with the database, as shown in the figure below.

         Then run the startup class again and find that an error is still reported. So I went back to the configuration file class to watch repeatedly and found no low-level mistakes such as spelling mistakes. I went to the database connection tool to open the edit connection of the current connection database, and I found the problem: the database connected by the connection tool Navicat is localhost, which is the localhost. The database on the computer window, and the project is connected to the database on the remote server. I want to find the table built by the local database on the remote server database. Of course, it will report an unknown database error! After modifying the database connection editor on Navicat to connect to the remote database and rebuild the table, re-run the startup class and find that the operation is successful.

Guess you like

Origin blog.csdn.net/m0_59705760/article/details/124644831