Files
cunkebao_v3/Moncter/config/database.php
2025-11-07 15:40:33 +08:00

27 lines
1.1 KiB
PHP
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.

<?php
return [
// 默认数据库连接(可选改为 mongodb
'default' => 'mysql', // 若需全局用 MongoDB改为 'mongodb'
'connections' => [
// ... 其他连接(如 mysql保持不变
// MongoDB 官方连接配置
'mongodb' => [
'driver' => 'mongodb',
'dsn' => 'mongodb://127.0.0.1:27017', // 集群可写mongodb://node1:27017,node2:27017
'database' => 'Moncter', // 目标数据库名
'username' => 'Moncter', // 无认证则省略
'password' => '123456', // 无认证则省略
'options' => [
'replicaSet' => '', // 副本集名称(无则留空)
'ssl' => false, // 是否启用 SSL
'connectTimeoutMS' => 3000, // 连接超时
'socketTimeoutMS' => 5000, // 读写超时
// 认证相关(若 MongoDB 启用认证)
'authSource' => 'admin', // 认证数据库(默认 admin
'authMechanism' => 'SCRAM-SHA-256', // 认证机制(默认推荐)
],
],
],
];