数据库

This commit is contained in:
wangxiaoxian 2026-03-03 14:23:00 +08:00
parent cbcd2f2ee2
commit 92de056a8e
1 changed files with 4 additions and 4 deletions

View File

@ -10,7 +10,7 @@ const createDatabase = async () => {
user: 'root', user: 'root',
password: '123456' password: '123456'
}); });
// 创建数据库 // 创建数据库
await connection.query('CREATE DATABASE IF NOT EXISTS rentease'); await connection.query('CREATE DATABASE IF NOT EXISTS rentease');
console.log('数据库创建成功'); console.log('数据库创建成功');
@ -25,8 +25,8 @@ const createDatabase = async () => {
// 创建数据库连接 - 使用MySQL // 创建数据库连接 - 使用MySQL
const sequelize = new Sequelize( const sequelize = new Sequelize(
'rentease', // 数据库名称 'rentease', // 数据库名称
'root', // 用户名 'rentease', // 用户名
'123456', // 密码 'Wxx@123!', // 密码
{ {
host: 'localhost', host: 'localhost',
dialect: 'mysql', dialect: 'mysql',
@ -61,4 +61,4 @@ const testConnection = async () => {
}; };
// 导出sequelize实例 // 导出sequelize实例
module.exports = sequelize; module.exports = sequelize;