Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问这个数据库是使用的mysql还是redis呢 #304

Open
xixixixi1230 opened this issue Aug 26, 2024 · 2 comments
Open

请问这个数据库是使用的mysql还是redis呢 #304

xixixixi1230 opened this issue Aug 26, 2024 · 2 comments

Comments

@xixixixi1230
Copy link

请问这个数据库是使用的mysql还是redis呢,我将sql文件导入mysql,启动redis服务,username和password写的mysql的用户名和密码,报错了

@aryangzhu
Copy link

aryangzhu commented Sep 2, 2024

spring.datasource.url=jdbc:mysql://localhost:3306/tp_music?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver 

从配置文件中可以看出使用的是MySQL,你要将报错信息粘贴出来,这样才能准确定位问题

@aryangzhu
Copy link

aryangzhu commented Sep 2, 2024

我忘了代码,推测一下哈,MySQL是作为DB存储来使用,Redis是作为缓存来使用。你可以先找个docker教程将mysql和redis分别启动,然后将项目中的配置文件和自己docker的容器配置做比较进行替换
image

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/springboot_learning?serverTimezone=Asia/Shanghai&characterEncoding=utf-8
    username: root
    password: root
  redis:
    host: localhost
    port: 6379
    password: 123456
    database: 0
    lettuce:
      pool:
        max-idle: 16
        max-active: 32
        min-idle: 8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants