java无法将Mysql与Spring工具套件连接?
tomcat端口和mysql端口应该相同吗强> 我想通过RESTAPI访问mysql数据库。我无法同时打开mysql工作台和运行spring boot。是因为两者使用相同的端口吗?另外,如果我更改应用程序中的端口-“server.port=7070”。属性项目未成功运行
应用程序。特性:
spring.datasource.url=jdbc:mysql://localhost:3306/playjava?useSSL=flase
spring.datasource.username=root
spring.datasource.password=root
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
server.port=3306
波姆。xml:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>RestWithJPACreateProfessor</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>RestWithJPACreateProfessor</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</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>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
请帮忙。先谢谢你
# 1 楼答案
我不得不卸载并重新安装spring工具套件和mysql。此外,我还必须卸载在我的计算机上(独立)运行的tomcat,因为我无法使用端口8080。这就是为什么我在spring项目中使用端口3306以及mysql。因此,我无法在项目运行时同时打开mysql