mysql 无法创建池的初始连接,o.a.tomcat.jdbc.pool.ConnectionPool:无法创建池的初始连接。春季启动+ MySql...

I want to connect Spring boot application with database with help of MySql WorkBranch

o.a.tomcat.jdbc.pool.ConnectionPool : Unable to create initial connections of pool.

is the exception i get

pom.xml

mysql

mysql-connector-java

5.1.27

application.properties

spring.thymeleaf.mode=LEGACYHTML5

#toa gore mora

# ===============================

# = DATA SOURCE

# ===============================

# Set here configurations for the database connection

# Connection url for the database "netgloo_blog"

spring.datasource.url = jdbc:mysql://localhost:3306/OnlineBanking

# Username and secret

spring.datasource.username = root

spring.datasource.password =

# Keep the connection alive if idle for a long time (needed in production)

spring.datasource.tomcat.max-active=1

# ===============================

# = JPA / HIBERNATE

# ===============================

# Use spring.jpa.properties.* for Hibernate native properties (the prefix is

# stripped before adding them to the entity manager).

# Show or not log for each sql query

spring.jpa.show-sql = true

# Hibernate ddl auto (create, create-drop, update): with "update" the database

# schema will be automatically updated accordingly to java entities found in

# the project

spring.jpa.hibernate.ddl-auto = update

# Allows Hibernate to generate SQL optimized for a particular DBMS

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

In MySql Workbranch server is set here is image:https://i.stack.imgur.com/F3G4s.png

I get this erros

2018-05-13 22:04:38.234 ERROR 6176 --- [ 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_162]

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_162]

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_162]

at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_162]

at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) ~[mysql-connector-java-5.1.27.jar:na]

Can somebody help to connect spring boot with the database

Thanks

解决方案

Assuming you are in a development environment and security is not an issue for you, you can create a login by using the following SQL commands

CREATE USER 'jeffrey'@'*' IDENTIFIED BY 'password';

GRANT ALL ON * TO 'jeffrey'@'*';

See also

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值