48 lines
1.2 KiB
Markdown
48 lines
1.2 KiB
Markdown
# Quick Fix: Database Connection
|
|
|
|
## The Issue
|
|
|
|
You tried to connect with `blockscout` user, but the **custom explorer backend** uses the `explorer` user.
|
|
|
|
## Correct Command
|
|
|
|
```bash
|
|
# ✅ Correct - for custom explorer backend
|
|
PGPASSWORD='***REDACTED-LEGACY-PW***' psql -h localhost -U explorer -d explorer -c "SELECT 1;"
|
|
```
|
|
|
|
## Quick Steps
|
|
|
|
1. **Test connection:**
|
|
```bash
|
|
PGPASSWORD='***REDACTED-LEGACY-PW***' psql -h localhost -U explorer -d explorer -c "SELECT 1;"
|
|
```
|
|
|
|
2. **Run migration:**
|
|
```bash
|
|
cd explorer-monorepo
|
|
PGPASSWORD='***REDACTED-LEGACY-PW***' psql -h localhost -U explorer -d explorer \
|
|
-f backend/database/migrations/0010_track_schema.up.sql
|
|
```
|
|
|
|
3. **Restart server:**
|
|
```bash
|
|
pkill -f api-server
|
|
cd explorer-monorepo/backend
|
|
export DB_PASSWORD='***REDACTED-LEGACY-PW***'
|
|
./bin/api-server
|
|
```
|
|
|
|
4. **Verify:**
|
|
```bash
|
|
curl http://localhost:8080/health
|
|
```
|
|
|
|
## Two Separate Systems
|
|
|
|
- **Blockscout:** User `blockscout`, Password `blockscout`, DB `blockscout`
|
|
- **Custom Explorer:** User `explorer`, Password `***REDACTED-LEGACY-PW***`, DB `explorer`
|
|
|
|
See `docs/DATABASE_CONNECTION_GUIDE.md` for full details.
|
|
|