Files
aitsc/docker/mysql/init.sql

27 lines
765 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.
-- MySQL数据库初始化脚本
-- 用于Docker容器启动时自动创建数据库和用户
-- 创建数据库(如果不存在)
CREATE DATABASE IF NOT EXISTS prompt_master CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- 创建用户(如果不存在)
CREATE USER IF NOT EXISTS 'prompt_user'@'%' IDENTIFIED BY 'prompt_password';
-- 授予权限
GRANT ALL PRIVILEGES ON prompt_master.* TO 'prompt_user'@'%';
-- 刷新权限
FLUSH PRIVILEGES;
-- 使用数据库
USE prompt_master;
-- 创建基础表结构(如果需要)
-- 注意实际的表结构会由Flask-SQLAlchemy自动创建
-- 这里只是示例,实际项目中可能不需要
-- 设置字符集
SET NAMES utf8mb4;
SET CHARACTER SET utf8mb4;
SET character_set_connection=utf8mb4;