## 事象
[[PostgreSQL]]にアクセスしようとすると以下のエラーが発生する。
```error
pq: SSL is not enabled on the server
```
`.config/lazysql/config.toml`
```toml
[[database]]
Name = 'postgres-sample'
URL = 'postgres://postgres:root@localhost:15432/mydb
Provider = 'postgres'
Username = ''
Password = ''
Hostname = ''
Port = ''
DBName = 'mydb'
URLParams = ''
Commands = []
```
`docker-compose.yml`
```yaml
services:
db:
image: postgres:17
container_name: postgres-sample
ports:
- 15432:5432
volumes:
- ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
environment:
POSTGRES_PASSWORD: root
```
### 環境
| 対象 | バージョン |
| -------------- | ------------------------ |
| [[Lazysql]] | 0.3.3 |
| [[PostgreSQL]] | 17.2 |
| [[Docker]] | 27.5.0, build a187fa5 |
| [[Ubuntu]] | 24.04.1 LTS (in [[WSL]]) |
## 原因
[[PostgreSQL]]の[[SSL]]が有効になっていたから。サーバー側が[[SSL]]に対応していないのでエラーになる。
## 解決方法
URLに `?sslmode=disable'` を追加する。
```diff
[[database]]
Name = 'postgres-sample'
- URL = 'postgres://postgres:root@localhost:15432/mydb
+ URL = 'postgres://postgres:root@localhost:15432/mydb?sslmode=disable'
```
## 参考
- [can't disable ssl mode when connecting to postgresql · Issue #31 · jorgerojas26/lazysql](https://github.com/jorgerojas26/lazysql/issues/31)