到这个时候,我们应该安装上Mysql 开始工作。首先下载安装包mysql-installer-community-8.0.20.0.msi
ps:看到有的人window环境下安装不成功可以下载一下依赖的包 NDP452-KB2901907-x86-x64-AllOS-ENU.exe
一、安装mysql 环境和可视化工具
二、导入需要用到登录的验证的sql语句文件
在新数据库中创建一个gin厂库 数据类型是utf8mb4;
然后直接在可视化工具中导入文件执行sql语言,自动创建数据库文件和表。
gin.sql 文件直接贴出来:
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for manager
-- ----------------------------
DROP TABLE IF EXISTS `manager`;
CREATE TABLE `manager` (
`id` int(0) NOT NULL AUTO_INCREMENT,
`username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`password` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`mobile` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`email` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`status` tinyint(1) NULL DEFAULT NULL,
`role_id` int(0) NULL DEFAULT NULL,
`add_time` int(0) NULL DEFAULT NULL,
`is_super` tinyint(1) NULL DEFAULT 0,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of manager
-- ----------------------------
INSERT INTO `manager` VALUES (1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', '15201686411', '518864@qq.com', 1, 1, 0, 1);
INSERT INTO `manager` VALUES (2, 'zhagnsan', 'e10adc3949ba59abbe56e057f20f883e', '15201686412', '34233869@qq.com', 1, 2, 1581661532, 0);
-- ----------------------------
-- Table structure for role
-- ----------------------------
DROP TABLE IF EXISTS `role`;
CREATE TABLE `role` (
`id` int(0) NOT NULL AUTO_INCREMENT,
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`status` tinyint(1) NULL DEFAULT NULL,
`add_time` int(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of role
-- ----------------------------
INSERT INTO `role` VALUES (2, '销售部门', '销售部门', 1, 1591061390);
INSERT INTO `role` VALUES (4, '编辑部门', '这是一个编辑部门,主要负责文章编辑', 1, 1591062092);
INSERT INTO `role` VALUES (9, '超级管理员22', '我是一个超级管理员222', 1, 1631072961);
INSERT INTO `role` VALUES (14, '软件部门', '软件部门', 1, 1631075350);
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(0) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of user
-- ----------------------------
SET FOREIGN_KEY_CHECKS = 1;
运行后结果:
我们就需要在项目中 config文件夹中创建一个专门放配置文件的,也就是app.ini 文件
app_name = 你好 gin
# possible values: DEBUG, INFO, WARNING, ERROR, FATAL
log_level = DEBUG
admin_path = /admin
[mysql]
ip = 192.168.0.6
port = 3306
user = root
password = 123456
database = gin
[redis]
ip = 127.0.0.1
port = 6379
在使用时,我们要结合学习的CSDN
来看一下啊具体的操作
希望对你有所帮助!如有任何其他问题,请随时提问。