第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Spring Boot、MySQL、Tomcat 無法在 Eclipse 中創(chuàng)建池的初始連接

Spring Boot、MySQL、Tomcat 無法在 Eclipse 中創(chuàng)建池的初始連接

尚方寶劍之說 2022-12-21 14:38:24
我在 Eclipse 中使用 Spring Boot 和 REST API 創(chuàng)建了一個 webapp。當(dāng)我嘗試使用 Tomcat 8 運(yùn)行它時(shí),它給出錯誤 “oatomcat.jdbc.pool.ConnectionPool:無法創(chuàng)建池的初始連接?!蔽覈L試使用提供的解決方案,但似乎沒有任何效果,它總是給出相同的錯誤。這是我的 application.properties 文件 -spring.datasource.url = jdbc:mysql://localhost:3306/dbase?autoReconnect=true&useSSL=falsespring.datasource.username = 1234spring.datasource.password = 1234spring.datasource.driver-class-name=com.mysql.jdbc.Driverspring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialectspring.jpa.hibernate.ddl-auto = update這是 pom.xml 文件 -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">  <modelVersion>4.0.0</modelVersion>  <grouId>com.springboot</groupId>  <artifactId>springbootrestapi</artifactId>  <packaging>war</packaging>  <version>0.0.1-SNAPSHOT</version>  <name>springbootrestapiexample Maven Webapp</name>  <url>http://maven.apache.org</url>  <parent>        <groupId>org.springframework.boot</groupId>        <artifactId>spring-boot-starter-parent</artifactId>        <version>1.5.4.RELEASE</version>        <relativePath/> <!-- lookup parent from repository -->    </parent>  <dependencies>    <dependency>      <groupId>junit</groupId>      <artifactId>junit</artifactId>      <version>4.11</version>      <scope>test</scope>    </dependency>    <dependency>            <groupId>org.springframework.boot</groupId>            <artifactId>spring-boot-starter-data-jpa</artifactId>        </dependency>        <dependency>            <groupId>org.springframework.boot</groupId>            <artifactId>spring-boot-starter-web</artifactId>        </dependency>
查看完整描述

2 回答

?
楊魅力

TA貢獻(xiàn)1811條經(jīng)驗(yàn) 獲得超6個贊

你必須改變很多東西

1.轉(zhuǎn)到C盤中的mysql安裝目錄并找到my.ini文件。

將 default_authentication_plugin 更改為此

default_authentication_plugin=mysql_native_password
  1. 然后轉(zhuǎn)到您的 MySQL 命令行客戶端,登錄后,運(yùn)行此查詢:

    ALTER USER 'yourusername'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpassword';

然后重新啟動 mysql 服務(wù)并運(yùn)行你的程序。

"yourusername"和替換"yourpassword"為您實(shí)際的 MySQL 用戶名和密碼。

  1. 轉(zhuǎn)到 POM 并替換:

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>

使用最新的 MySQL8 連接器

<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java --><dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>8.0.15</version></dependency>

我希望它有所幫助 :)


查看完整回答
反對 回復(fù) 2022-12-21
?
料青山看我應(yīng)如是

TA貢獻(xiàn)1772條經(jīng)驗(yàn) 獲得超8個贊

這些是要檢查的東西

  1. 驗(yàn)證數(shù)據(jù)庫服務(wù)器是否啟動并運(yùn)行,以及您的連接詳細(xì)信息在獨(dú)立測試中是否正常工作。

  2. 如果不存在則授予訪問權(quán)限,請?jiān)L問:

不允許主機(jī) 'xxx.xx.xxx.xxx' 連接到此 MySQL 服務(wù)器

  1. 你為什么首先在 tomcat 中運(yùn)行 spring boot 而不是作為一個胖罐?其次,mysql客戶端JAR應(yīng)該包含在tomcat庫中

  2. 如果服務(wù)器可用連接不足,則增加 mySQL 最大連接數(shù)


查看完整回答
反對 回復(fù) 2022-12-21
  • 2 回答
  • 0 關(guān)注
  • 149 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號