skip to Main Content

Caused by: org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution [Access denied for user ‘root’@’localhost’ (using password: YES)] [n/a] Caused by: org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution [Access denied for user ‘root’@’localhost’@’localhost’ (using password: YES)] [n/a] Caused by: java.sql.SQLException: Access denied for user ‘root’@’localhost’@’localhost’ (using password: YES)
Execution failed for task ‘:SpringProApplication.main()’.

Process ‘command ‘C:Program FilesJavajdk-20binjava.exe” finished with non-zero exit value 1

  • Try:

Run with –stacktrace option to get the stack trace.
Run with –info or –debug option to get more log output.
Run with –scan to get full insights.
Get more help at https://help.gradle.org.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use ‘–warning-mode all’ to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 12s
3 actionable tasks: 2 executed, 1 up-to-date

connect Mysql using Spring boot Java

2

Answers


  1. Chosen as BEST ANSWER
    application.Properties file
    
    spring.datasource.url=jdbc:mysql://localhost:3306/newdb
    spring.datasource.username=root
    spring.datasource.password=password
    spring.jpa.show-sql: true
    spring.jpa.generate-ddl=true
    spring.jpa.hibernate.ddl.auto=update
    spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
    
    
    --------------
    SpringProApplictionTests.java file
    
    package com.SpringPro.demo;
    
    import org.junit.jupiter.api.Test;
    import org.springframework.boot.test.context.SpringBootTest;
    
        @SpringBootTest
        class SpringProApplicationTests {
        
            @Test
            void contextLoads() {
            }
    
    }
    I created Employee and SpringProApplication.java file also
    

  2. it seems that you haven’t filled out the application.yaml properties out properly, however there is so little information I can’t be sure.

    # In application.yml
    spring:
      datasource:
        url: jdbc:mysql://localhost:3306/yourdatabase
        username: root
        password: yourpassword
    

    It would also be helpful if you provided more information such as the code you are running and the SQL configuration.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search