#Unable to connect MySQL DB with Springboot Application

1 messages · Page 1 of 1 (latest)

stable igloo
#

Hello!!

I am starting to learn Springboot and I am building a simple CRUD application. I am connecting MySQL DB with Springboot Application, but I am facing the error "Unknown Database: 'testdb' ".

Here is my application.properties file:

spring.datasource.url=jdbc:mysql://localhost:3306/testdb?useSSL=false
spring.datasource.username=root
spring.datasource.password=karan1997

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect

# Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto=update

Also, the full error, I have pasted in this link: https://textdoc.co/yAGwspHYk0U3alvx

Also, some of the results of the MySQL command I have tried are:

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| karan1234 |
| mysql |
| order-service |
| performance_schema |
| sys |
| testdb |
+--------------------+

mysql> SHOW GLOBAL VARIABLES LIKE 'PORt'
-> ;
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port | 3306 |
+---------------+-------+
1 row in set (0.00 sec)

Also, I have quickly tried connecting to the DB using Python, so I believe that the issue is not with the incorrect port number or DB name.

Please help me with this!! Thank you!!

amber pikeBOT
#

This post has been reserved for your question.

Hey @stable igloo! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

gilded plover
#

try restarting mysql

left solar
#

Try below steps:
remove ?useSSL=false
remove spring.jpa.properties.hibernate.dialect property

#

also if possible can u try to connect with only java project once instead of spring boot directly ? I can provide link of my video if u need

brave cloud
stable igloo
amber pikeBOT
stable igloo
stable igloo