Yin-Hongwei / music-website

🎧 Vue + SpringBoot + MyBatis 音乐网站
Apache License 2.0
5.32k stars 1.43k forks source link

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

Open xixixixi1230 opened 2 weeks ago

xixixixi1230 commented 2 weeks ago

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

aryangzhu commented 1 week ago
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 commented 1 week ago

我忘了代码,推测一下哈,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