简体   繁体   English

oatomcat.jdbc.pool.ConnectionPool:无法创建池的初始连接。 春季启动+ MySql

[英]o.a.tomcat.jdbc.pool.ConnectionPool : Unable to create initial connections of pool. Spring Boot + MySql

I want to connect Spring boot application with database with help of MySql WorkBranch 我想借助MySql WorkBranch将Spring Boot应用程序与数据库连接

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

is the exception i get 是我的例外

pom.xml pom.xml

<dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.27</version>
        </dependency>

application.properties 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 在MySql Workbranch服务器中设置的图像如下: 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 有人可以帮助将Spring Boot与数据库连接谢谢吗

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 假设您处于开发环境中,并且安全性不是问题,则可以使用以下SQL命令创建登录名

CREATE USER 'jeffrey'@'*' IDENTIFIED BY 'password';
GRANT ALL ON * TO 'jeffrey'@'*';

See also 也可以看看

https://dev.mysql.com/doc/refman/8.0/en/create-user.html and https://dev.mysql.com/doc/refman/8.0/en/grant.html https://dev.mysql.com/doc/refman/8.0/en/create-user.htmlhttps://dev.mysql.com/doc/refman/8.0/en/grant.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 org.apache.tomcat.jdbc.pool.ConnectionPool - 无法创建池的初始连接 - org.apache.tomcat.jdbc.pool.ConnectionPool - Unable to create initial connections of pool org.apache.tomcat.jdbc.pool.ConnectionPool-无法使用yml文件创建池的初始连接 - org.apache.tomcat.jdbc.pool.ConnectionPool - Unable to create initial connections of pool with yml file SpringBoot MySQL JDBC 无法创建池的初始连接 - SpringBoot MySQL JDBC Unable to create initial connections of pool 无法创建池异步Jersey + Spring + Tomcat的初始连接 - Unable to create initial connections of pool Async Jersey+Spring+Tomcat 无法创建池的初始连接,无法获取 JDBC 连接错误 - Unable to create initial connections of pool, Unable to obtain JDBC Connection errors Tomcat池未重置池。 连接过多错误 - tomcat pool not resetting the pool. Getting too many connections error 无法在springboot中创建初始连接池 - Unable to create initial pool of connections in springboot 严重:无法使用context.xml文件创建pool-tomcat 7的初始连接 - SEVERE: Unable to create initial connections of pool - tomcat 7 with context.xml file Spring池与MySQL的连接 - Spring pool connections with MySQL 尝试设置数据库连接的初始池大小(spring-boot) - Try set initial pool size of database connections (spring-boot)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM