Files
wuhan-saga/database/fix_admin_user.sql
王文昊 3f5ea4bffd chore: add gitignore files and database fix admin user script
add root, server, client gitignore files for different environment ignore rules, and add sql script to fix or initialize admin user with bcrypt encrypted password
2026-05-23 15:12:56 +08:00

12 lines
523 B
SQL
Raw 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.

-- 检查是否存在 admin 用户
SELECT * FROM sys_user WHERE username = 'admin';
-- 如果不存在或密码错误,执行以下插入/更新
-- 密码是 admin123使用 BCrypt 加密
INSERT INTO sys_user (username, password, nickname, status, create_time, update_time)
VALUES ('admin', '$2a$10$N.zmdr9k7uOCQb376NoUnuTJ8iAt6Z5EHsM8lE9lBOsl7iAt6Z5EO', '管理员', 1, NOW(), NOW())
ON DUPLICATE KEY UPDATE
password = '$2a$10$N.zmdr9k7uOCQb376NoUnuTJ8iAt6Z5EHsM8lE9lBOsl7iAt6Z5EO',
status = 1,
update_time = NOW();