Files
2026-01-04 17:19:04 +08:00

61 lines
1.9 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- ============================================
-- 梦幻西游一站式运营管理平台 - 数据库初始化脚本
-- MySQL 8.4 兼容版本
-- 创建日期2026-01-04
-- ============================================
-- 使用数据库
USE mhxy_web_vue;
-- 设置字符集
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ============================================
-- 表admin_users管理员用户表
-- ============================================
DROP TABLE IF EXISTS `admin_users`;
CREATE TABLE `admin_users` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`username` VARCHAR(64) NOT NULL COMMENT '用户名',
`password_hash` VARCHAR(255) NOT NULL COMMENT '密码哈希bcrypt加密',
`real_name` VARCHAR(50) NULL COMMENT '真实姓名',
`role_id` INT NOT NULL DEFAULT 1 COMMENT '角色ID1:超级管理员)',
`status` TINYINT NOT NULL DEFAULT 1 COMMENT '状态1:正常, 0:禁用)',
`created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE INDEX `idx_username` (`username`),
INDEX `idx_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='管理员用户表';
-- ============================================
-- 插入默认管理员账号
-- 用户名admin
-- 密码admin123bcrypt加密10轮
-- ============================================
INSERT INTO `admin_users` (`username`, `password_hash`, `real_name`, `role_id`, `status`)
VALUES (
'admin',
'$2b$10$e1hDPxr/A9nbqbJNJFV9COVPfYt.b6REbrvh2rSrn29I1CEE9tski',
'超级管理员',
1,
1
);
-- ============================================
-- 验证数据
-- ============================================
SELECT
id,
username,
real_name,
role_id,
status,
created_at
FROM admin_users;
SET FOREIGN_KEY_CHECKS = 1;
-- 初始化完成