实战篇01 02 注视频开头的建立数据库可以直接通过MySQL workbench建立无需考虑基础篇的内容 1.建立数据库 最好使用MySQL workbench执行 SETNAMES utf8mb4;-- 创建数据库createdatabasebig_event;-- 使用数据库usebig_event;-- 用户表createtableuser(idintunsignedprimarykeyauto_incrementcommentID,usernamevarchar(20)notnulluniquecomment用户名,passwordvarchar(32)comment密码,nicknamevarchar(10)defaultcomment昵称,emailvarchar(128)defaultcomment邮箱,user_picvarchar(128)defaultcomment头像,create_timedatetimenotnullcomment创建时间,update_timedatetimenotnullcomment修改时间)comment用户表;-- 分类表createtablecategory(idintunsignedprimarykeyauto_incrementcommentID,category_namevarchar(32)notnullcomment分类名称,category_aliasvarchar(32)notnullcomment分类别名,create_userintunsignednotnullcomment创建人ID,create_timedatetimenotnullcomment创建时间,update_timedatetimenotnullcomment修改时间,constraintfk_category_userforeignkey(create_user)referencesuser(id)-- 外键约束);-- 文章表createtablearticle(idintunsignedprimarykeyauto_incrementcommentID,titlevarchar(30)notnullcomment文章标题,contentvarchar(10000)notnullcomment文章内容,cover_imgvarchar(128)notnullcomment文章封面,statevarchar(3)default草稿comment文章状态: 只能是[已发布] 或者 [草稿],category_idintunsignedcomment文章分类ID,create_userintunsignednotnullcomment创建人ID,create_timedatetimenotnullcomment创建时间,update_timedatetimenotnullcomment修改时间,constraintfk_article_categoryforeignkey(category_id)referencescategory(id),-- 外键约束constraintfk_article_userforeignkey(create_user)referencesuser(id)-- 外键约束)以上内容在项目内的DB Navigator看的这是因为原教程在做这件事的时候并没有关闭之前的项目实际上可以放在新建项目后查看2.新建项目新项目不完整在main下新建resources目录双击resrouces即可在resources下新建文件application.yml3.修改pom文件parentparentgroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-parent/artifactIdversion3.1.3/version/parentdependenciesdependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-web/artifactId/dependency!--mybatis依赖--dependencygroupIdorg.mybatis.spring.boot/groupIdartifactIdmybatis-spring-boot/artifactIdversion3.0.0/version/dependency!--MySQL驱动依赖--dependencygroupIdcom.mysql/groupIdartifactIdmysql-connector-j/artifactId/dependency刷新maven3.配置信息在Application.yml中spring:datasource:driver-class-name:com.mysql.cj.jdbc.Driverurl:jdbc:mysql://localhost:3306/big_eventuser:***password:***4.创建包结构与实体类在APP所在目录下创建包controller、mapper、service、service\iml、pojo(实体类)、utils工具类将资料中的02资料\04_综合案例资料\02_后台资料\03_实体类下的实体类user、article、category导入–对应数据库中的三张表用来封装从数据库中取出的数据复制后再ideal的pojo中粘贴5.修改启动类对APP重命名启动类名字工程名Application大驼峰添加注解SpringBootApplication以及固定的函数SpringApplication.run(启动类.classmain函数的参数SpringBootApplicationpublicclassBigEventApplication{publicstaticvoidmain(String[]args){System.out.println(Hello World!);SpringApplication.run(BigEventApplication.class,args);}}Tomcat完成启动
黑马SpringBoot3+Vue3(实战篇)学习记录 一:新建数据库、新建项目
发布时间:2026/5/18 22:18:19
实战篇01 02 注视频开头的建立数据库可以直接通过MySQL workbench建立无需考虑基础篇的内容 1.建立数据库 最好使用MySQL workbench执行 SETNAMES utf8mb4;-- 创建数据库createdatabasebig_event;-- 使用数据库usebig_event;-- 用户表createtableuser(idintunsignedprimarykeyauto_incrementcommentID,usernamevarchar(20)notnulluniquecomment用户名,passwordvarchar(32)comment密码,nicknamevarchar(10)defaultcomment昵称,emailvarchar(128)defaultcomment邮箱,user_picvarchar(128)defaultcomment头像,create_timedatetimenotnullcomment创建时间,update_timedatetimenotnullcomment修改时间)comment用户表;-- 分类表createtablecategory(idintunsignedprimarykeyauto_incrementcommentID,category_namevarchar(32)notnullcomment分类名称,category_aliasvarchar(32)notnullcomment分类别名,create_userintunsignednotnullcomment创建人ID,create_timedatetimenotnullcomment创建时间,update_timedatetimenotnullcomment修改时间,constraintfk_category_userforeignkey(create_user)referencesuser(id)-- 外键约束);-- 文章表createtablearticle(idintunsignedprimarykeyauto_incrementcommentID,titlevarchar(30)notnullcomment文章标题,contentvarchar(10000)notnullcomment文章内容,cover_imgvarchar(128)notnullcomment文章封面,statevarchar(3)default草稿comment文章状态: 只能是[已发布] 或者 [草稿],category_idintunsignedcomment文章分类ID,create_userintunsignednotnullcomment创建人ID,create_timedatetimenotnullcomment创建时间,update_timedatetimenotnullcomment修改时间,constraintfk_article_categoryforeignkey(category_id)referencescategory(id),-- 外键约束constraintfk_article_userforeignkey(create_user)referencesuser(id)-- 外键约束)以上内容在项目内的DB Navigator看的这是因为原教程在做这件事的时候并没有关闭之前的项目实际上可以放在新建项目后查看2.新建项目新项目不完整在main下新建resources目录双击resrouces即可在resources下新建文件application.yml3.修改pom文件parentparentgroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-parent/artifactIdversion3.1.3/version/parentdependenciesdependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-web/artifactId/dependency!--mybatis依赖--dependencygroupIdorg.mybatis.spring.boot/groupIdartifactIdmybatis-spring-boot/artifactIdversion3.0.0/version/dependency!--MySQL驱动依赖--dependencygroupIdcom.mysql/groupIdartifactIdmysql-connector-j/artifactId/dependency刷新maven3.配置信息在Application.yml中spring:datasource:driver-class-name:com.mysql.cj.jdbc.Driverurl:jdbc:mysql://localhost:3306/big_eventuser:***password:***4.创建包结构与实体类在APP所在目录下创建包controller、mapper、service、service\iml、pojo(实体类)、utils工具类将资料中的02资料\04_综合案例资料\02_后台资料\03_实体类下的实体类user、article、category导入–对应数据库中的三张表用来封装从数据库中取出的数据复制后再ideal的pojo中粘贴5.修改启动类对APP重命名启动类名字工程名Application大驼峰添加注解SpringBootApplication以及固定的函数SpringApplication.run(启动类.classmain函数的参数SpringBootApplicationpublicclassBigEventApplication{publicstaticvoidmain(String[]args){System.out.println(Hello World!);SpringApplication.run(BigEventApplication.class,args);}}Tomcat完成启动