Я пытаюсь подключиться к базе данных MySQL.
persistent.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="myApp">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<!-- TODO: Change file location to your H2 database ! -->
<property name="javax.persistence.jdbc.url"
value="jdbc:mysql://localhost:3306/myDB"/>
<property name="hibernate.dialect"value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="true"/>
</properties>
</persistence-unit>
</persistence>
application.properties
spring.datasource.url = jdbc:mysql://localhost:3306/myDB?useSSL=false
# Username and password
spring.datasource.username = root
spring.datasource.password = root
Error
Exception in thread "main" org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Caused by: java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)