fdb2 1.0.23 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -607
- package/bootstrap.js +26 -0
- package/dist/public/bootstrap.js +5 -5
- package/dist/public/explorer.js +203 -197
- package/dist/public/favicon.ico +0 -0
- package/dist/public/index.js +189 -168
- package/dist/public/layout.js +4 -4
- package/dist/public/vue.js +120 -90
- package/dist/scripts/electron-build.js +145 -0
- package/dist/scripts/electron-dev.js +116 -0
- package/dist/server/service/connection.service.d.ts.map +1 -1
- package/dist/server/service/connection.service.js +3 -7
- package/dist/server/service/connection.service.js.map +1 -1
- package/dist/server/service/connection.service.ts +3 -7
- package/dist/server/utils/data-dir.d.ts +19 -0
- package/dist/server/utils/data-dir.d.ts.map +1 -0
- package/dist/server/utils/data-dir.js +84 -0
- package/dist/server/utils/data-dir.js.map +1 -0
- package/dist/server/utils/data-dir.ts +47 -0
- package/electron/main.js +269 -0
- package/electron/preload.js +59 -0
- package/electron/updater.js +181 -0
- package/package.json +28 -35
- package/public/favicon.icns +0 -0
- package/public/favicon.ico +0 -0
- package/scripts/electron-build.js +145 -0
- package/scripts/electron-dev.js +116 -0
- package/server.js +6 -3
- package/dist/package.json +0 -139
- package/dist/pnpm-lock.yaml +0 -7332
- package/dist/scripts/nw-build.js +0 -136
- package/dist/scripts/nw-dev.js +0 -67
- package/dist/server/service/session.service.ts +0 -158
- package/scripts/nw-build.js +0 -136
- package/scripts/nw-dev.js +0 -67
package/README.md
CHANGED
|
@@ -1,365 +1,64 @@
|
|
|
1
|
-
# fdb2 -
|
|
1
|
+
# fdb2 - Cross-Platform Database Management Tool
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[中文](README_zh.md) | English
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## 中文
|
|
8
|
-
|
|
9
|
-
一款轻量级、跨平台的数据库管理工具,支持多种数据库类型,提供类似 Navicat Premium 的使用体验。
|
|
10
|
-
|
|
11
|
-

|
|
12
|
-
|
|
13
|
-
## 快速开始
|
|
14
|
-
|
|
15
|
-
本项目是一个开源的数据库管理工具。你可以通过 npm 全局安装作为命令行工具使用,也可以下载我们构建好的桌面客户端应用。
|
|
16
|
-
|
|
17
|
-
### 桌面客户端下载 (推荐)
|
|
18
|
-
如果你不想使用命令行,可以直接下载我们预构建好的跨平台桌面客户端:
|
|
19
|
-
- **Windows / macOS / Linux**: [前往 Release 页面下载客户端](https://github.com/fefeding/fdb2/releases/tag/client)
|
|
20
|
-
- 解压后双击运行即可,无需任何环境配置。
|
|
21
|
-
|
|
22
|
-
### 命令行安装
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
# 全局安装
|
|
26
|
-
npm install -g fdb2
|
|
27
|
-
|
|
28
|
-
# 或使用 yarn
|
|
29
|
-
yarn global add fdb2
|
|
30
|
-
|
|
31
|
-
# 或使用 pnpm
|
|
32
|
-
pnpm add -g fdb2
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### 启动服务
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
# 启动数据库管理工具
|
|
39
|
-
fdb2 start
|
|
40
|
-
|
|
41
|
-
# 停止服务
|
|
42
|
-
fdb2 stop
|
|
43
|
-
|
|
44
|
-
# 查看服务状态
|
|
45
|
-
fdb2 status
|
|
46
|
-
|
|
47
|
-
# 重启服务
|
|
48
|
-
fdb2 restart
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### 访问应用
|
|
52
|
-
|
|
53
|
-
启动服务后,在浏览器中打开(具体路径请看输出的信息,端口有可能变化):
|
|
54
|
-
```
|
|
55
|
-
http://localhost:9800
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
**主页**: [https://surl.fit/tools/tools/fdb2](https://surl.fit/tools/tools/fdb2)
|
|
59
|
-
|
|
60
|
-
## 功能特性
|
|
61
|
-
|
|
62
|
-
### 连接管理
|
|
63
|
-
- 支持 8 种数据库类型:MySQL、PostgreSQL、SQLite、SQL Server、Oracle、CockroachDB、MongoDB、SAP HANA
|
|
64
|
-
- 可视化连接配置界面,操作简单直观
|
|
65
|
-
- 一键测试连接,快速验证配置
|
|
66
|
-
- 连接信息本地安全存储,无需重复输入
|
|
67
|
-
|
|
68
|
-
### 数据库结构
|
|
69
|
-
- 清晰的数据库信息概览
|
|
70
|
-
- 详细的表结构查看
|
|
71
|
-
- 完整的列信息、索引、外键关系展示
|
|
72
|
-
- 实时显示数据库大小和统计信息
|
|
73
|
-
|
|
74
|
-
### 数据操作
|
|
75
|
-
- 表数据快速查看和分页浏览
|
|
76
|
-
- 灵活的条件查询和排序
|
|
77
|
-
- 便捷的数据插入、编辑、删除
|
|
78
|
-
- 支持导出数据为 JSON、CSV 格式
|
|
79
|
-
|
|
80
|
-
### SQL 查询
|
|
81
|
-
- 代码编辑器风格的 SQL 输入框
|
|
82
|
-
- SQL 语法格式化,提升可读性
|
|
83
|
-
- 自动保存查询历史记录
|
|
84
|
-
- 批量查询结果展示
|
|
85
|
-
|
|
86
|
-
### 核心优势
|
|
87
|
-
- **零配置启动**:全局安装后即可使用,无需复杂配置
|
|
88
|
-
- **跨平台支持**:Windows、macOS、Linux 全平台兼容
|
|
89
|
-
- **轻量高效**:资源占用低
|
|
90
|
-
- **本地存储**:数据保存在本地,安全可靠
|
|
91
|
-
- **离线使用**:无需联网即可管理本地数据库
|
|
92
|
-
|
|
93
|
-
## 使用指南
|
|
94
|
-
|
|
95
|
-
### 添加数据库连接
|
|
96
|
-
|
|
97
|
-
1. 打开浏览器访问 `http://localhost:9800`
|
|
98
|
-
2. 点击左侧导航的"连接管理"
|
|
99
|
-
3. 点击"新增连接"按钮
|
|
100
|
-
4. 填写连接信息:
|
|
101
|
-
- **连接名称**:自定义名称,便于识别(如:生产环境 MySQL)
|
|
102
|
-
- **数据库类型**:选择对应的数据库类型
|
|
103
|
-
- **主机地址**:数据库服务器地址(本地数据库使用 `localhost` 或 `127.0.0.1`)
|
|
104
|
-
- **端口**:数据库服务端口(会自动填充默认端口)
|
|
105
|
-
- **数据库名称**:要连接的数据库名
|
|
106
|
-
- **用户名/密码**:数据库认证信息
|
|
107
|
-
5. 点击"测试连接"验证配置是否正确
|
|
108
|
-
6. 保存连接配置
|
|
109
|
-
|
|
110
|
-
### 查看数据库结构
|
|
111
|
-
|
|
112
|
-
1. 在左侧导航选择"数据库结构"
|
|
113
|
-
2. 选择已配置的数据库连接
|
|
114
|
-
3. 选择要查看的数据库
|
|
115
|
-
4. 浏览表列表和详细信息:
|
|
116
|
-
- **表基本信息**:行数、大小等统计信息
|
|
117
|
-
- **列定义**:数据类型、约束、默认值等
|
|
118
|
-
- **索引信息**:主键、唯一索引、普通索引
|
|
119
|
-
- **外键关系**:表之间的关联关系
|
|
120
|
-
|
|
121
|
-
### 查看和编辑表数据
|
|
122
|
-
|
|
123
|
-
1. 在表列表中点击"数据"按钮
|
|
124
|
-
2. 设置查询条件:
|
|
125
|
-
- **WHERE 条件**:输入过滤条件(如:`id > 100`)
|
|
126
|
-
- **排序字段**:指定排序方式(如:`create_time DESC`)
|
|
127
|
-
- **每页显示**:调整分页大小(10/50/100/500)
|
|
128
|
-
3. 点击"查询"按钮执行查询
|
|
129
|
-
4. 支持的操作:
|
|
130
|
-
- **查看详情**:点击行查看完整数据
|
|
131
|
-
- **编辑记录**:修改数据后保存
|
|
132
|
-
- **删除记录**:删除不需要的数据
|
|
133
|
-
- **插入新数据**:点击"新增"按钮添加数据
|
|
134
|
-
- **导出数据**:选择 JSON 或 CSV 格式导出
|
|
135
|
-
|
|
136
|
-
### 执行 SQL 查询
|
|
137
|
-
|
|
138
|
-
1. 点击左侧导航的"SQL 查询"
|
|
139
|
-
2. 选择数据库连接
|
|
140
|
-
3. 在编辑器中输入 SQL 语句
|
|
141
|
-
4. 快捷操作:
|
|
142
|
-
- **Ctrl + Enter**(Windows)或 **Cmd + Enter**(Mac):快速执行
|
|
143
|
-
- 点击"格式化"按钮:美化 SQL 语句
|
|
144
|
-
- 查看历史记录:点击历史记录按钮选择之前的查询
|
|
145
|
-
5. 查看查询结果,支持导出功能
|
|
146
|
-
|
|
147
|
-
### 常用 SQL 示例
|
|
148
|
-
|
|
149
|
-
```sql
|
|
150
|
-
-- 查询表前 10 条数据
|
|
151
|
-
SELECT * FROM table_name LIMIT 10;
|
|
152
|
-
|
|
153
|
-
-- 按条件查询
|
|
154
|
-
SELECT * FROM users WHERE status = 'active' ORDER BY created_at DESC;
|
|
155
|
-
|
|
156
|
-
-- 统计数据
|
|
157
|
-
SELECT COUNT(*) as total, status FROM users GROUP BY status;
|
|
158
|
-
|
|
159
|
-
-- 插入数据
|
|
160
|
-
INSERT INTO users (name, email, status) VALUES ('张三', 'zhangsan@example.com', 'active');
|
|
161
|
-
|
|
162
|
-
-- 更新数据
|
|
163
|
-
UPDATE users SET status = 'inactive' WHERE last_login < '2024-01-01';
|
|
164
|
-
|
|
165
|
-
-- 删除数据
|
|
166
|
-
DELETE FROM logs WHERE created_at < '2024-01-01';
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
## 支持的数据库类型
|
|
170
|
-
|
|
171
|
-
| 数据库类型 | 默认端口 | 特性 |
|
|
172
|
-
|-----------|---------|------|
|
|
173
|
-
| MySQL | 3306 | 支持存储过程、触发器、视图、全文搜索 |
|
|
174
|
-
| PostgreSQL | 5432 | 支持存储过程、触发器、视图、JSON 类型 |
|
|
175
|
-
| SQLite | - | 轻量级,文件型数据库,无需服务器 |
|
|
176
|
-
| SQL Server | 1433 | 微软数据库,支持存储过程、触发器、视图 |
|
|
177
|
-
| Oracle | 1521 | 企业级数据库,功能强大 |
|
|
178
|
-
| CockroachDB | 26257 | 分布式 SQL 数据库,兼容 PostgreSQL |
|
|
179
|
-
| MongoDB | 27017 | NoSQL 文档数据库 |
|
|
180
|
-
| SAP HANA | 39013 | 内存数据库,高性能分析 |
|
|
181
|
-
|
|
182
|
-
**兼容性说明**:
|
|
183
|
-
- MariaDB、TiDB 兼容 MySQL,选择 MySQL 类型即可
|
|
184
|
-
- Aurora MySQL 兼容 MySQL,选择 MySQL 类型即可
|
|
185
|
-
- Aurora PostgreSQL 兼容 PostgreSQL,选择 PostgreSQL 类型即可
|
|
186
|
-
- Better-SQLite3 兼容 SQLite,选择 SQLite 类型即可
|
|
187
|
-
|
|
188
|
-
## 常见问题
|
|
189
|
-
|
|
190
|
-
### 安装和启动
|
|
191
|
-
|
|
192
|
-
**Q: 安装后无法启动服务?**
|
|
193
|
-
|
|
194
|
-
A: 请检查以下几点:
|
|
195
|
-
1. 确认已正确安装:`npm install -g fdb2`
|
|
196
|
-
2. 检查 Node.js 版本(建议 v14 或更高):`node --version`
|
|
197
|
-
3. 查看错误信息:`fdb2 start --verbose`
|
|
198
|
-
4. 检查端口是否被占用
|
|
199
|
-
|
|
200
|
-
**Q: 如何更换端口?**
|
|
201
|
-
|
|
202
|
-
A: 使用 `-p` 参数指定端口:
|
|
203
|
-
```bash
|
|
204
|
-
fdb2 start -p 8080
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
也可以通过环境变量设置端口:
|
|
208
|
-
```bash
|
|
209
|
-
# Windows
|
|
210
|
-
set PORT=8080
|
|
211
|
-
fdb2 start
|
|
212
|
-
|
|
213
|
-
# Mac/Linux
|
|
214
|
-
PORT=8080 fdb2 start
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### 连接问题
|
|
218
|
-
|
|
219
|
-
**Q: 连接数据库失败怎么办?**
|
|
220
|
-
|
|
221
|
-
A: 请按以下步骤排查:
|
|
222
|
-
1. 确认数据库服务正在运行
|
|
223
|
-
2. 检查网络连接和端口是否正确
|
|
224
|
-
3. 验证用户名和密码是否正确
|
|
225
|
-
4. 检查数据库是否允许远程连接
|
|
226
|
-
5. 查看数据库防火墙设置
|
|
227
|
-
|
|
228
|
-
**Q: SQLite 数据库连接失败?**
|
|
229
|
-
|
|
230
|
-
A: SQLite 连接需要提供数据库文件路径:
|
|
231
|
-
- 绝对路径:`D:\data\mydb.sqlite`
|
|
232
|
-
- 相对路径:`./data/mydb.sqlite`(相对于数据目录)
|
|
233
|
-
- 确保文件存在且有读取权限
|
|
234
|
-
|
|
235
|
-
### 数据操作
|
|
236
|
-
|
|
237
|
-
**Q: 查询结果为空?**
|
|
238
|
-
|
|
239
|
-
A: 可能的原因:
|
|
240
|
-
1. 表中确实没有数据
|
|
241
|
-
2. WHERE 条件过于严格
|
|
242
|
-
3. 数据库名称或表名错误
|
|
243
|
-
4. 查询权限不足
|
|
244
|
-
|
|
245
|
-
**Q: 无法编辑或删除数据?**
|
|
246
|
-
|
|
247
|
-
A: 请检查:
|
|
248
|
-
1. 是否有足够的数据库权限
|
|
249
|
-
2. 表是否有外键约束
|
|
250
|
-
3. 数据是否被锁定
|
|
251
|
-
4. 查看数据库错误日志
|
|
252
|
-
|
|
253
|
-
### 性能问题
|
|
254
|
-
|
|
255
|
-
**Q: 查询速度很慢?**
|
|
256
|
-
|
|
257
|
-
A: 优化建议:
|
|
258
|
-
1. 添加适当的索引
|
|
259
|
-
2. 限制查询结果数量(使用 LIMIT)
|
|
260
|
-
3. 避免使用 `SELECT *`,只查询需要的字段
|
|
261
|
-
4. 优化 WHERE 条件
|
|
262
|
-
5. 考虑分批处理大数据量
|
|
263
|
-
|
|
264
|
-
**Q: 数据库信息加载很慢?**
|
|
265
|
-
|
|
266
|
-
A: 可能的原因:
|
|
267
|
-
1. 数据库中表数量过多
|
|
268
|
-
2. 表数据量过大
|
|
269
|
-
3. 网络延迟
|
|
270
|
-
4. 数据库性能问题
|
|
271
|
-
|
|
272
|
-
### 数据安全
|
|
273
|
-
|
|
274
|
-
**Q: 连接密码安全吗?**
|
|
275
|
-
|
|
276
|
-
A: 当前版本密码以明文形式存储在本地配置文件中。建议:
|
|
277
|
-
1. 不要在公共电脑上保存敏感数据库连接
|
|
278
|
-
2. 定期更换数据库密码
|
|
279
|
-
3. 使用只读权限的账号进行日常操作
|
|
280
|
-
4. 生产环境建议使用加密连接(SSL/TLS)
|
|
281
|
-
|
|
282
|
-
**Q: 如何备份数据库连接配置?**
|
|
283
|
-
|
|
284
|
-
A: 复制配置文件即可:
|
|
285
|
-
```bash
|
|
286
|
-
# Windows
|
|
287
|
-
copy C:\Users\用户名\.db-tool\connections.json D:\backup\
|
|
288
|
-
|
|
289
|
-
# Mac/Linux
|
|
290
|
-
cp ~/.db-tool/connections.json ~/backup/
|
|
291
|
-
```
|
|
5
|
+
> 🚀 A lightweight, open-source database management tool supporting 8+ database types, providing a Navicat Premium-like professional experience — completely free and running locally!
|
|
292
6
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
**Q: 如何更新到最新版本?**
|
|
296
|
-
|
|
297
|
-
A: 重新安装即可:
|
|
298
|
-
```bash
|
|
299
|
-
npm update -g fdb2
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
**Q: 如何完全卸载?**
|
|
303
|
-
|
|
304
|
-
A: 执行以下步骤:
|
|
305
|
-
```bash
|
|
306
|
-
# 卸载程序
|
|
307
|
-
npm uninstall -g fdb2
|
|
308
|
-
|
|
309
|
-
# 删除数据目录(可选,会删除所有连接配置)
|
|
310
|
-
# Windows
|
|
311
|
-
rmdir /s C:\Users\用户名\.db-tool
|
|
312
|
-
|
|
313
|
-
# Mac/Linux
|
|
314
|
-
rm -rf ~/.db-tool
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
## 获取帮助
|
|
318
|
-
|
|
319
|
-
- **GitHub Issues**: [提交问题](https://github.com/fefeding/fdb2/issues)
|
|
320
|
-
- **文档**: 查看在线文档
|
|
321
|
-
- **社区**: 加入用户交流群
|
|
322
|
-
|
|
323
|
-
---
|
|
324
|
-
|
|
325
|
-
**享受使用 fdb2 数据库管理工具!如有任何问题,欢迎反馈。**
|
|
326
|
-
|
|
327
|
-
---
|
|
7
|
+

|
|
328
8
|
|
|
329
|
-
##
|
|
9
|
+
## 🔥 Core Features
|
|
330
10
|
|
|
331
|
-
|
|
11
|
+
### 🌐 Multi-Database Support
|
|
12
|
+
- **8+ Database Types**: MySQL, PostgreSQL, SQLite, SQL Server, Oracle, CockroachDB, MongoDB, SAP HANA
|
|
13
|
+
- **Compatibility Extensions**: MariaDB/TiDB/Aurora compatible with MySQL, Aurora PostgreSQL compatible with PostgreSQL
|
|
14
|
+
- **NoSQL Support**: MongoDB document database
|
|
332
15
|
|
|
333
|
-
|
|
16
|
+
### 🎯 Professional Features
|
|
17
|
+
- **Connection Management**: Visual configuration, one-click testing, secure local storage
|
|
18
|
+
- **Structure Browsing**: Complete display of tables, indexes, foreign keys, views, stored procedures
|
|
19
|
+
- **Data Operations**: Full CRUD operations, conditional queries, pagination, batch import/export
|
|
20
|
+
- **SQL Editor**: Syntax highlighting, auto-completion, formatting, query history
|
|
21
|
+
- **Performance Monitoring**: Real-time connection status, query performance analysis, slow query detection
|
|
334
22
|
|
|
335
|
-
###
|
|
23
|
+
### ⚡ Key Advantages
|
|
24
|
+
- **Zero Configuration**: Ready to use immediately after global installation
|
|
25
|
+
- **Cross-Platform**: Full compatibility with Windows, macOS, and Linux
|
|
26
|
+
- **Lightweight & Efficient**: Minimal resource usage, fast startup
|
|
27
|
+
- **Local Storage**: All data stored locally, secure and reliable
|
|
28
|
+
- **Offline Usage**: Manage local and remote databases without internet
|
|
29
|
+
- **Fully Open Source**: MIT license, free to use and contribute
|
|
336
30
|
|
|
337
|
-
|
|
31
|
+
## 🚀 Quick Start
|
|
338
32
|
|
|
339
|
-
|
|
340
|
-
If you prefer not to use the command line, you can directly download our pre-built cross-platform desktop client:
|
|
341
|
-
- **Windows / macOS / Linux**: [Go to Release page to download](https://github.com/fefeding/fdb2/releases/tag/client)
|
|
342
|
-
- Unzip and double-click to run, no environment configuration required.
|
|
33
|
+
### 📥 Installation Options
|
|
343
34
|
|
|
344
|
-
####
|
|
35
|
+
#### 💻 Desktop Client (Recommended)
|
|
36
|
+
Download the pre-built cross-platform desktop application for immediate use:
|
|
37
|
+
- **[Windows / macOS / Linux Client Download](https://github.com/fefeding/fdb2/releases/tag/client)**
|
|
38
|
+
- Unzip and double-click to run, no environment setup required
|
|
345
39
|
|
|
40
|
+
#### 📦 Command Line Tool
|
|
41
|
+
Install globally via npm/yarn/pnpm:
|
|
346
42
|
```bash
|
|
347
|
-
#
|
|
43
|
+
# npm (recommended)
|
|
348
44
|
npm install -g fdb2
|
|
349
45
|
|
|
350
|
-
#
|
|
46
|
+
# yarn
|
|
351
47
|
yarn global add fdb2
|
|
352
48
|
|
|
353
|
-
#
|
|
49
|
+
# pnpm
|
|
354
50
|
pnpm add -g fdb2
|
|
355
51
|
```
|
|
356
52
|
|
|
357
|
-
|
|
53
|
+
### ▶️ Start Service
|
|
358
54
|
|
|
359
55
|
```bash
|
|
360
56
|
# Start the database management tool
|
|
361
57
|
fdb2 start
|
|
362
58
|
|
|
59
|
+
# Start with custom port
|
|
60
|
+
fdb2 start -p 8080
|
|
61
|
+
|
|
363
62
|
# Stop service
|
|
364
63
|
fdb2 stop
|
|
365
64
|
|
|
@@ -370,296 +69,76 @@ fdb2 status
|
|
|
370
69
|
fdb2 restart
|
|
371
70
|
```
|
|
372
71
|
|
|
373
|
-
|
|
72
|
+
### 🌐 Access Application
|
|
374
73
|
|
|
375
|
-
After
|
|
74
|
+
After successful startup, open in your browser (check startup logs for the actual port):
|
|
376
75
|
```
|
|
377
76
|
http://localhost:9800
|
|
378
77
|
```
|
|
379
78
|
|
|
380
|
-
**
|
|
381
|
-
|
|
382
|
-
### Features
|
|
383
|
-
|
|
384
|
-
#### Connection Management
|
|
385
|
-
- Supports 8 database types: MySQL, PostgreSQL, SQLite, SQL Server, Oracle, CockroachDB, MongoDB, SAP HANA
|
|
386
|
-
- Visual connection configuration interface, simple and intuitive
|
|
387
|
-
- One-click test connection for quick verification
|
|
388
|
-
- Secure local storage of connection information
|
|
389
|
-
|
|
390
|
-
#### Database Structure
|
|
391
|
-
- Clear database information overview
|
|
392
|
-
- Detailed table structure viewing
|
|
393
|
-
- Complete column info, indexes, and foreign key relationships
|
|
394
|
-
- Real-time database size and statistics
|
|
395
|
-
|
|
396
|
-
#### Data Operations
|
|
397
|
-
- Quick table data viewing and pagination
|
|
398
|
-
- Flexible conditional queries and sorting
|
|
399
|
-
- Convenient data insert, edit, and delete
|
|
400
|
-
- Export data to JSON and CSV formats
|
|
401
|
-
|
|
402
|
-
#### SQL Query
|
|
403
|
-
- Code editor-style SQL input
|
|
404
|
-
- SQL syntax formatting for better readability
|
|
405
|
-
- Auto-save query history
|
|
406
|
-
- Batch query result display
|
|
407
|
-
|
|
408
|
-
#### Key Advantages
|
|
409
|
-
- **Zero Configuration**: Ready to use after global installation
|
|
410
|
-
- **Cross-Platform**: Full compatibility with Windows, macOS, and Linux
|
|
411
|
-
- **Lightweight & Efficient**: Low resource usage
|
|
412
|
-
- **Local Storage**: Data saved locally, safe and reliable
|
|
413
|
-
- **Offline Use**: Manage local databases without internet
|
|
414
|
-
|
|
415
|
-
### Usage Guide
|
|
416
|
-
|
|
417
|
-
#### Add Database Connection
|
|
418
|
-
|
|
419
|
-
1. Open browser and visit `http://localhost:9800`
|
|
420
|
-
2. Click "Connection Management" in the left navigation
|
|
421
|
-
3. Click "New Connection" button
|
|
422
|
-
4. Fill in connection information:
|
|
423
|
-
- **Connection Name**: Custom name for easy identification (e.g., Production MySQL)
|
|
424
|
-
- **Database Type**: Select the corresponding database type
|
|
425
|
-
- **Host**: Database server address (use `localhost` or `127.0.0.1` for local databases)
|
|
426
|
-
- **Port**: Database service port (default port will be auto-filled)
|
|
427
|
-
- **Database Name**: The database name to connect to
|
|
428
|
-
- **Username/Password**: Database authentication credentials
|
|
429
|
-
5. Click "Test Connection" to verify the configuration
|
|
430
|
-
6. Save the connection configuration
|
|
431
|
-
|
|
432
|
-
#### View Database Structure
|
|
433
|
-
|
|
434
|
-
1. Select "Database Structure" in the left navigation
|
|
435
|
-
2. Select a configured database connection
|
|
436
|
-
3. Select the database to view
|
|
437
|
-
4. Browse table list and details:
|
|
438
|
-
- **Table Info**: Row count, size, and other statistics
|
|
439
|
-
- **Column Definitions**: Data types, constraints, default values, etc.
|
|
440
|
-
- **Index Info**: Primary keys, unique indexes, regular indexes
|
|
441
|
-
- **Foreign Keys**: Relationships between tables
|
|
442
|
-
|
|
443
|
-
#### View and Edit Table Data
|
|
444
|
-
|
|
445
|
-
1. Click the "Data" button in the table list
|
|
446
|
-
2. Set query conditions:
|
|
447
|
-
- **WHERE Condition**: Enter filter conditions (e.g., `id > 100`)
|
|
448
|
-
- **Order By**: Specify sorting (e.g., `create_time DESC`)
|
|
449
|
-
- **Page Size**: Adjust pagination (10/50/100/500)
|
|
450
|
-
3. Click "Query" button to execute
|
|
451
|
-
4. Supported operations:
|
|
452
|
-
- **View Details**: Click a row to view complete data
|
|
453
|
-
- **Edit Record**: Modify data and save
|
|
454
|
-
- **Delete Record**: Remove unwanted data
|
|
455
|
-
- **Insert Data**: Click "New" button to add data
|
|
456
|
-
- **Export Data**: Choose JSON or CSV format for export
|
|
457
|
-
|
|
458
|
-
#### Execute SQL Queries
|
|
459
|
-
|
|
460
|
-
1. Click "SQL Query" in the left navigation
|
|
461
|
-
2. Select a database connection
|
|
462
|
-
3. Enter SQL statements in the editor
|
|
463
|
-
4. Quick actions:
|
|
464
|
-
- **Ctrl + Enter** (Windows) or **Cmd + Enter** (Mac): Quick execute
|
|
465
|
-
- Click "Format" button: Beautify SQL statements
|
|
466
|
-
- View history: Click history button to select previous queries
|
|
467
|
-
5. View query results with export support
|
|
468
|
-
|
|
469
|
-
#### Common SQL Examples
|
|
470
|
-
|
|
471
|
-
```sql
|
|
472
|
-
-- Query first 10 rows
|
|
473
|
-
SELECT * FROM table_name LIMIT 10;
|
|
474
|
-
|
|
475
|
-
-- Conditional query
|
|
476
|
-
SELECT * FROM users WHERE status = 'active' ORDER BY created_at DESC;
|
|
477
|
-
|
|
478
|
-
-- Aggregate data
|
|
479
|
-
SELECT COUNT(*) as total, status FROM users GROUP BY status;
|
|
480
|
-
|
|
481
|
-
-- Insert data
|
|
482
|
-
INSERT INTO users (name, email, status) VALUES ('John', 'john@example.com', 'active');
|
|
483
|
-
|
|
484
|
-
-- Update data
|
|
485
|
-
UPDATE users SET status = 'inactive' WHERE last_login < '2024-01-01';
|
|
486
|
-
|
|
487
|
-
-- Delete data
|
|
488
|
-
DELETE FROM logs WHERE created_at < '2024-01-01';
|
|
489
|
-
```
|
|
490
|
-
|
|
491
|
-
### Supported Database Types
|
|
492
|
-
|
|
493
|
-
| Database Type | Default Port | Features |
|
|
494
|
-
|--------------|-------------|----------|
|
|
495
|
-
| MySQL | 3306 | Stored procedures, triggers, views, full-text search |
|
|
496
|
-
| PostgreSQL | 5432 | Stored procedures, triggers, views, JSON type |
|
|
497
|
-
| SQLite | - | Lightweight, file-based, no server required |
|
|
498
|
-
| SQL Server | 1433 | Microsoft database, stored procedures, triggers, views |
|
|
499
|
-
| Oracle | 1521 | Enterprise-grade, feature-rich |
|
|
500
|
-
| CockroachDB | 26257 | Distributed SQL, PostgreSQL compatible |
|
|
501
|
-
| MongoDB | 27017 | NoSQL document database |
|
|
502
|
-
| SAP HANA | 39013 | In-memory database, high-performance analytics |
|
|
503
|
-
|
|
504
|
-
**Compatibility Notes**:
|
|
505
|
-
- MariaDB, TiDB are compatible with MySQL — select MySQL type
|
|
506
|
-
- Aurora MySQL is compatible with MySQL — select MySQL type
|
|
507
|
-
- Aurora PostgreSQL is compatible with PostgreSQL — select PostgreSQL type
|
|
508
|
-
- Better-SQLite3 is compatible with SQLite — select SQLite type
|
|
509
|
-
|
|
510
|
-
### FAQ
|
|
511
|
-
|
|
512
|
-
<details>
|
|
513
|
-
<summary>Installation & Startup</summary>
|
|
514
|
-
|
|
515
|
-
**Q: Service won't start after installation?**
|
|
516
|
-
|
|
517
|
-
A: Please check the following:
|
|
518
|
-
1. Confirm correct installation: `npm install -g fdb2`
|
|
519
|
-
2. Check Node.js version (v14+ recommended): `node --version`
|
|
520
|
-
3. View error details: `fdb2 start --verbose`
|
|
521
|
-
4. Check if the port is already in use
|
|
522
|
-
|
|
523
|
-
**Q: How to change the port?**
|
|
524
|
-
|
|
525
|
-
A: Use the `-p` parameter:
|
|
526
|
-
```bash
|
|
527
|
-
fdb2 start -p 8080
|
|
528
|
-
```
|
|
529
|
-
|
|
530
|
-
Or set via environment variable:
|
|
531
|
-
```bash
|
|
532
|
-
# Windows
|
|
533
|
-
set PORT=8080
|
|
534
|
-
fdb2 start
|
|
535
|
-
|
|
536
|
-
# Mac/Linux
|
|
537
|
-
PORT=8080 fdb2 start
|
|
538
|
-
```
|
|
539
|
-
|
|
540
|
-
</details>
|
|
541
|
-
|
|
542
|
-
<details>
|
|
543
|
-
<summary>Connection Issues</summary>
|
|
544
|
-
|
|
545
|
-
**Q: Failed to connect to database?**
|
|
546
|
-
|
|
547
|
-
A: Follow these troubleshooting steps:
|
|
548
|
-
1. Confirm the database service is running
|
|
549
|
-
2. Check network connection and port settings
|
|
550
|
-
3. Verify username and password
|
|
551
|
-
4. Check if the database allows remote connections
|
|
552
|
-
5. Review database firewall settings
|
|
553
|
-
|
|
554
|
-
**Q: SQLite connection failed?**
|
|
555
|
-
|
|
556
|
-
A: SQLite requires a database file path:
|
|
557
|
-
- Absolute path: `D:\data\mydb.sqlite`
|
|
558
|
-
- Relative path: `./data/mydb.sqlite` (relative to data directory)
|
|
559
|
-
- Ensure the file exists and is readable
|
|
560
|
-
|
|
561
|
-
</details>
|
|
562
|
-
|
|
563
|
-
<details>
|
|
564
|
-
<summary>Data Operations</summary>
|
|
565
|
-
|
|
566
|
-
**Q: Empty query results?**
|
|
79
|
+
> 💡 **Tip**: Default port is 9800, but if occupied, it will automatically select another available port
|
|
567
80
|
|
|
568
|
-
|
|
569
|
-
1. The table has no data
|
|
570
|
-
2. WHERE condition is too strict
|
|
571
|
-
3. Wrong database or table name
|
|
572
|
-
4. Insufficient query permissions
|
|
81
|
+
## 📊 Supported Database Types
|
|
573
82
|
|
|
574
|
-
|
|
83
|
+
| Database Type | Default Port | Key Features |
|
|
84
|
+
|--------------|-------------|-------------|
|
|
85
|
+
| **MySQL** | 3306 | Stored procedures, triggers, views, full-text search, partitioning |
|
|
86
|
+
| **PostgreSQL** | 5432 | Stored procedures, triggers, views, JSON/JSONB, window functions |
|
|
87
|
+
| **SQLite** | - | Lightweight file-based database, zero configuration, embedded |
|
|
88
|
+
| **SQL Server** | 1433 | T-SQL, stored procedures, CLR integration, AlwaysOn |
|
|
89
|
+
| **Oracle** | 1521 | PL/SQL, RAC, Data Guard, advanced security |
|
|
90
|
+
| **CockroachDB** | 26257 | Distributed SQL, strong consistency, automatic sharding |
|
|
91
|
+
| **MongoDB** | 27017 | NoSQL document database, aggregation pipeline, indexing |
|
|
92
|
+
| **SAP HANA** | 39013 | In-memory database, real-time analytics, column store |
|
|
575
93
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
94
|
+
### 🔄 Compatibility Notes
|
|
95
|
+
- **MariaDB/TiDB**: Compatible with MySQL protocol — select MySQL type
|
|
96
|
+
- **Amazon Aurora MySQL**: Compatible with MySQL — select MySQL type
|
|
97
|
+
- **Amazon Aurora PostgreSQL**: Compatible with PostgreSQL — select PostgreSQL type
|
|
98
|
+
- **Better-SQLite3**: Compatible with SQLite — select SQLite type
|
|
581
99
|
|
|
582
|
-
|
|
100
|
+
## 🤝 Contribution Guide
|
|
583
101
|
|
|
584
|
-
|
|
585
|
-
<summary>Performance</summary>
|
|
102
|
+
Contributions are welcome! Code contributions, bug reports, or feature suggestions are all appreciated.
|
|
586
103
|
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
A: Optimization suggestions:
|
|
590
|
-
1. Add appropriate indexes
|
|
591
|
-
2. Limit query results (use LIMIT)
|
|
592
|
-
3. Avoid `SELECT *`, only query needed fields
|
|
593
|
-
4. Optimize WHERE conditions
|
|
594
|
-
5. Consider batch processing for large datasets
|
|
595
|
-
|
|
596
|
-
**Q: Slow database info loading?**
|
|
597
|
-
|
|
598
|
-
A: Possible reasons:
|
|
599
|
-
1. Too many tables in the database
|
|
600
|
-
2. Large table data size
|
|
601
|
-
3. Network latency
|
|
602
|
-
4. Database performance issues
|
|
603
|
-
|
|
604
|
-
</details>
|
|
605
|
-
|
|
606
|
-
<details>
|
|
607
|
-
<summary>Data Security</summary>
|
|
608
|
-
|
|
609
|
-
**Q: Are connection passwords secure?**
|
|
610
|
-
|
|
611
|
-
A: The current version stores passwords in plain text in local config files. Recommendations:
|
|
612
|
-
1. Don't save sensitive database connections on public computers
|
|
613
|
-
2. Change database passwords regularly
|
|
614
|
-
3. Use read-only accounts for daily operations
|
|
615
|
-
4. Use encrypted connections (SSL/TLS) in production
|
|
616
|
-
|
|
617
|
-
**Q: How to backup connection config?**
|
|
618
|
-
|
|
619
|
-
A: Simply copy the config file:
|
|
104
|
+
### Development Environment Setup
|
|
620
105
|
```bash
|
|
621
|
-
#
|
|
622
|
-
|
|
106
|
+
# Clone repository
|
|
107
|
+
git clone https://github.com/fefeding/fdb2.git
|
|
108
|
+
cd fdb2
|
|
623
109
|
|
|
624
|
-
#
|
|
625
|
-
|
|
626
|
-
```
|
|
627
|
-
|
|
628
|
-
</details>
|
|
629
|
-
|
|
630
|
-
<details>
|
|
631
|
-
<summary>Update & Uninstall</summary>
|
|
110
|
+
# Install dependencies
|
|
111
|
+
pnpm install
|
|
632
112
|
|
|
633
|
-
|
|
113
|
+
# Start development server
|
|
114
|
+
pnpm dev
|
|
634
115
|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
npm update -g fdb2
|
|
116
|
+
# Build production version
|
|
117
|
+
pnpm build
|
|
638
118
|
```
|
|
639
119
|
|
|
640
|
-
|
|
120
|
+
### Contribution Workflow
|
|
121
|
+
1. Fork the project
|
|
122
|
+
2. Create a feature branch (`git checkout -b feature/your-feature`)
|
|
123
|
+
3. Commit changes (`git commit -am 'Add some feature'`)
|
|
124
|
+
4. Push to branch (`git push origin feature/your-feature`)
|
|
125
|
+
5. Create Pull Request
|
|
641
126
|
|
|
642
|
-
|
|
643
|
-
```bash
|
|
644
|
-
# Uninstall
|
|
645
|
-
npm uninstall -g fdb2
|
|
127
|
+
## 📄 License
|
|
646
128
|
|
|
647
|
-
|
|
648
|
-
# Windows
|
|
649
|
-
rmdir /s C:\Users\YourName\.db-tool
|
|
129
|
+
This project is licensed under the [MIT License](LICENSE) — fully open source and free to use.
|
|
650
130
|
|
|
651
|
-
|
|
652
|
-
rm -rf ~/.db-tool
|
|
653
|
-
```
|
|
654
|
-
|
|
655
|
-
</details>
|
|
131
|
+
## 🙏 Acknowledgments
|
|
656
132
|
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
-
|
|
660
|
-
-
|
|
661
|
-
-
|
|
133
|
+
Thanks to all contributors and users for their support! Special thanks to the following tech stack:
|
|
134
|
+
- Vue 3 + TypeScript
|
|
135
|
+
- Vite build tool
|
|
136
|
+
- Bootstrap 5 UI framework
|
|
137
|
+
- vue-i18n internationalization
|
|
138
|
+
- Pinia state management
|
|
662
139
|
|
|
663
140
|
---
|
|
664
141
|
|
|
665
|
-
**Enjoy using fdb2 Database Management Tool!
|
|
142
|
+
**Enjoy using fdb2 Database Management Tool! For any issues, please report at [GitHub Issues](https://github.com/fefeding/fdb2/issues).**
|
|
143
|
+
|
|
144
|
+
<!-- Chinese version available at [README_zh.md](README_zh.md) -->
|