aidress/mysql-init/01-init.sql
2025-03-21 17:09:40 +08:00

14 lines
527 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.

-- 创建数据库
CREATE DATABASE IF NOT EXISTS ai_dressing CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- 创建用户并授权
CREATE USER IF NOT EXISTS 'ai_user'@'%' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON ai_dressing.* TO 'ai_user'@'%';
FLUSH PRIVILEGES;
-- 选择数据库
USE ai_dressing;
-- 初始化顺序保证表不会因外键约束而创建失败
-- 注意这里不需要创建表因为应用会使用Alembic自动创建
-- 这个文件主要用于确保数据库和用户设置正确