Files
akmon/doc_news/NAVICAT_CONNECTION_CHECKLIST.md
2026-01-20 08:04:15 +08:00

120 lines
3.0 KiB
Markdown
Raw Permalink 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.
# Supabase + Navicat 连接检查清单
## ✅ 连接前检查清单
### 📋 必需信息收集
- [ ] **Supabase项目引用ID**: `___________________`
- [ ] **数据库密码**: `___________________` (创建项目时设置的)
- [ ] **网络环境**: 确认可以访问外部服务
### 🔧 Navicat配置检查
#### 基本连接设置
- [ ] **连接类型**: PostgreSQL
- [ ] **主机**: `db.[项目引用ID].supabase.co` (不带https://)
- [ ] **端口**: `5432`
- [ ] **数据库**: `postgres`
- [ ] **用户名**: `postgres`
- [ ] **密码**: (数据库密码,不是账户密码)
#### SSL设置
- [ ] **启用SSL**: ✅ 勾选
- [ ] **SSL模式**: `require``prefer`
- [ ] **证书**: 无需配置
#### 高级设置
- [ ] **连接超时**: `30`
- [ ] **服务器版本**: PostgreSQL 15+
## 🚨 常见错误对照表
| 错误信息 | 可能原因 | 解决方案 |
|---------|---------|---------|
| `tenant or user not found` | 用户名或主机地址错误 | 确认用户名是`postgres`,主机是`db.xxx.supabase.co` |
| `password authentication failed` | 密码错误 | 使用数据库密码,不是账户密码 |
| `connection timed out` | 网络问题或端口错误 | 检查端口5432确认网络连通性 |
| `SSL connection error` | SSL配置问题 | 启用SSL模式设为`require` |
## 📞 获取连接信息步骤
### 在Supabase Dashboard中:
1. **登录**: https://app.supabase.com/
2. **选择项目**: 点击您的项目
3. **进入设置**: 左侧菜单 → Settings → Database
4. **复制信息**: 在 "Connection info" 部分
### 关键信息位置:
```
Host: db.abcdefghijklmnop.supabase.co ← 复制这个
Port: 5432
Database: postgres
Username: postgres
Password: [您设置的密码]
```
## 🔍 连接测试
### 使用Navicat测试连接
1. 点击 "测试连接" 按钮
2. 看到 "连接成功" 即可
### 使用命令行测试 (可选)
```bash
psql "postgresql://postgres:您的密码@db.项目ID.supabase.co:5432/postgres?sslmode=require"
```
## 🛠️ 故障排除工具
### 工具1: 网络连通性测试
```bash
# Windows
telnet db.项目ID.supabase.co 5432
# 或者使用ping
ping db.项目ID.supabase.co
```
### 工具2: 在线连接工具
- Supabase Dashboard 内置 SQL Editor
- 在线PostgreSQL客户端
## 📋 成功连接确认
连接成功后,您应该看到:
```
📁 数据库: postgres
├── 📁 Schemas
│ ├── 📁 auth (Supabase认证)
│ ├── 📁 public (您的数据)
│ ├── 📁 storage (文件存储)
│ └── 📁 ... (其他系统schema)
```
## 🚀 下一步操作
连接成功后:
1. **部署数据库**:
```sql
-- 执行主数据库脚本
\i ai_multilingual_news_database.sql
```
2. **验证部署**:
```sql
SELECT COUNT(*) FROM information_schema.tables
WHERE table_schema = 'public' AND table_name LIKE 'ak_%';
```
3. **插入演示数据** (可选):
```sql
\i topics_comments_init_data.sql
```
---
**提示**: 如果仍有问题请检查您的Supabase项目是否处于活跃状态以及账户是否有足够的使用额度。