Java Springboot应用程序返回用户“的密码身份验证失败”;博士后;

Java Springboot应用程序返回用户“的密码身份验证失败”;博士后;,java,spring,postgresql,spring-boot,Java,Spring,Postgresql,Spring Boot,我正在尝试使用SpringBoot和postgres开发一个web应用程序。我曾经用PostgresSQLJDBC驱动程序作为依赖项创建一个StarterSpring项目。 我在application.properties文件中添加了以下内容 spring.datasource.url= jdbc:postgresql://localhost:5432/mydb spring.datasource.username=postgres spring.datasource.password="myp

我正在尝试使用SpringBoot和postgres开发一个web应用程序。我曾经用PostgresSQLJDBC驱动程序作为依赖项创建一个StarterSpring项目。 我在application.properties文件中添加了以下内容

spring.datasource.url= jdbc:postgresql://localhost:5432/mydb
spring.datasource.username=postgres
spring.datasource.password="mypassword@123"   
spring.jpa.hibernate.ddl-auto=validate
但是,这会引发以下错误:

2017-07-30 19:09:15.168 ERROR 2959 --- [           main] o.a.tomcat.jdbc.pool.ConnectionPool      : Unable to create initial connections of pool.

org.postgresql.util.PSQLException: FATAL: password authentication failed for user "postgres"
    at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:443) ~[postgresql-9.4.1212.jre7.jar:9.4.1212.jre7]
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:217) ~[postgresql-9.4.1212.jre7.jar:9.4.1212.jre7]
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51) ~[postgresql-9.4.1212.jre7.jar:9.4.1212.jre7]
    at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:215) ~[postgresql-9.4.1212.jre7.jar:9.4.1212.jre7]
    at org.postgresql.Driver.makeConnection(Driver.java:404) ~[postgresql-9.4.1212.jre7.jar:9.4.1212.jre7]
    at org.postgresql.Driver.connect(Driver.java:272) ~[postgresql-9.4.1212.jre7.jar:9.4.1212.jre7]
    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:310) ~[tomcat-jdbc-8.5.16.jar:na]
    at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:203) ~[tomcat-jdbc-8.5.16.jar:na]
    at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:735) [tomcat-jdbc-8.5.16.jar:na]
    at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:667) [tomcat-jdbc-8.5.16.jar:na]

我在macbook pro上使用的是java 1.8和postgres SQL 9.6。

您的密码应该是简单的文本(不添加字符,如


您是否尝试过不带@123的spring.datasource.password=“mypassword”运行此命令
ALTER USER“postgres”WITH password'mypassword@123“;
并重新启动您的应用程序以获取您的响应。@user7294900-刚刚尝试过。不幸的是,它不起作用。@AjitSoman-这也不起作用:-(对不起,没有双引号的意思是spring.datasource.password=MyPassword只是添加了一条注释。在我的情况下,我的密码包含“\”,因此我必须将其设为“\”,以转义字母,这样我的密码才能工作。
local   all             all                                     password
host    all             all             127.0.0.1/32            password
host    all             all             ::1/128                 password
 spring.datasource.password=mypassword