创建数据库、用户和密码参考sql语句
drop database if exists demoshop;
drop user if exists 'demoshop'@'%';
-- 支持emoji:需要mysql数据库参数: character_set_server=utf8mb4
create database demoshop default character set utf8mb4 collate utf8mb4_unicode_ci;
use demoshop;
create user 'demoshop'@'%' identified by 'demoshop123456';
grant all privileges on demoshop.* to 'demoshop'@'%';
flush privileges;
springboot框架MySQL连接application.yml配置
spring:profiles:# 配置的环境# active: #spring.profiles.active#active:servlet:multipart:max-file-size: 50MB #设置单个文件大小max-request-size: 50MB #设置单次请求文件的总大小jackson:locale: zh_CNtime-zone: GMT+8date-format: yyyy-MM-dd HH:mm:ss# 数据库配置datasource:type: com.alibaba.druid.pool.DruidDataSourcedriver-class-name: com.mysql.jdbc.Driverurl: jdbc:mysql://127.0.0.1:3306/demo?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimeZone=GMT+8username: rootpassword: root