0

Should the tomcat port and mysql port be same ? I want to access mysql databases via rest-apis. I'm not able to open mysql workbench and run spring boot at the same time. Is it because both are using the same port? Also if I change the port - "server.port=7070"- in application.properties the project does not run successfully.

application.properties:

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

pom.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>

Please help. Thank you in advance.

2
  • you have a typo in spring.datasource.url=jdbc:mysql://localhost:3306/playjava?useSSL=flase (flase instead of false) I dont know if it is your problem May 21, 2019 at 11:00
  • The server port and mysql port should not be the same indeed. May 21, 2019 at 11:01

1 Answer 1

0

I had to uninstall and reinstall spring tool suite and mysql. Also I had to uninstall tomcat which was running(independently) on my computer due to which I couldn't use port 8080. Which is why I was using port 3306 for spring project as well as mysql. Hence i couldn't simultaneously open mysql while the project was running.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.