Solucionado (ver solução)
Solucionado
(ver solução)
4
respostas

Erro ainda persiste mesmo com mysql instalado e root sem senha

Estou usando o mysql 8.0.11.0, consigo iniciar com mysql -u root sem senha, mas não consigo executar o comando: update user set authorization_string=password('') where user='root' and host='localhost'; erro: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('') where user='root' and host='localhost'' at line 1.

Quando executo java -jar cdcreact-1.0.0-SNAPSHOT.jar, aparece o mesmo erro apresentado nesse thread.

Passando a senha com o comando java -jar -Dspring.datasource.password="minhasenha" cdcreact-1.0.0-SNAPSHOT.jar também dá o mesmo erro:

2018-07-25 15:43:35.533 ERROR 7112 --- [ main] o.a.tomcat.jdbc.pool.ConnectionPool : Unable to create initial connections of pool.

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_161] (...) Caused by: java.lang.NullPointerException: null at com.mysql.jdbc.ConnectionImpl.getServerCharset(ConnectionImpl.java:3005) ~[mysql-connector-java-5.1.38.jar!/:5.1.38] 2018-07-25 15:43:35.535 WARN 7112 --- [ main] o.h.e.jdbc.internal.JdbcServicesImpl : HHH000342: Could not obtain connection to query metadata : Could not create connection to database server. 2018-07-25 15:43:35.537 WARN 7112 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set 2018-07-25 15:43:35.543 INFO 7112 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat 2018-07-25 15:43:35.550 ERROR 7112 --- [ main] o.s.boot.SpringApplication : Application startup failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) ~[spring-beans-4.2.4.RELEASE.jar!/:4.2.4.RELEASE] (...)

Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:104) ~[hibernate-core-4.3.11.Final.jar!/:4.3.11.Final] (...)java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) (...) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) (...) Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:104) (...)

4 respostas

Opa, você não precisa colocar as aspas na hora do senha... isso relacionado a execução do jar.

Em relação a trocar a senha do banco, não vi as aspas simples na sua query de update, no local onde você referencia uma string.

Estou tirando e colocando a senha por aqui:

Imagem

Sem aspas está ocorrendo a mesma exceção:

java -jar -Dspring.datasource.password=minhasenha cdcreact-1.0.0-SNAPSHOT.jar

Quanto à query de update estou copiando e colando os comandos dessa thread: https://cursos.alura.com.br/forum/topico-cdc-react-1-0-0-snapshot-jar-nao-roda-32362

Adicionei apenas um ; no final da segunda linha.

use mysql;
update user set authorization_string=password('') where user='root' and host='localhost'    
update user set plugin="mysql_native_password"; 
flush privileges;
exit;
solução!

Opa! Esse erro estava dando para mim no curso de Spring Boot.

Precisei desinstalar o Mysql 8 e instalar o 5.1.

Estou conseguindo rodar o jar do React tb.

Obrigado! Acabei usando o herokuapp