# Createdb: error: database creation failed: ERROR: database "discourse" already exists

**URL:** https://meta.discourse.org/t/createdb-error-database-creation-failed-error-database-discourse-already-exists/267614
**Category:** Self-hosting
**Created:** [June 8, 2023, 2:38am UTC](https://meta.discourse.org/t/createdb-error-database-creation-failed-error-database-discourse-already-exists/267614 "2023-06-08T02:38:37Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![whitewaterdeu](https://avatars.discourse-cdn.com/v4/letter/w/57b2e6/32.png) [@whitewaterdeu](https://meta.discourse.org/u/whitewaterdeu)
#### Post date: [June 9, 2023, 12:31am UTC](https://meta.discourse.org/t/createdb-error-database-creation-failed-error-database-discourse-already-exists/267614/3 "2023-06-09T00:31:39Z")

</div>

thanks for your reply ,jay  
i have searched for error line in the whole log , maybe it’s caused by

```plaintext
2023-06-08 01:19:04.972 UTC [55] postgres@template1 ERROR: database "discourse" already exists
2023-06-08 01:19:04.972 UTC [55] postgres@template1 STATEMENT: CREATE DATABASE discourse;
createdb: error: database creation failed: ERROR: database "discourse" already exists
I, [2023-06-08T01:19:04.977485 #1] INFO -- : 
I, [2023-06-08T01:19:04.978414 #1] INFO -- : > su postgres -c 'psql discourse -c "create user discourse;"' || true
2023-06-08 01:19:05.654 UTC [59] postgres@discourse ERROR: role "discourse" already exists
2023-06-08 01:19:05.654 UTC [59] postgres@discourse STATEMENT: create user discourse;
ERROR: role "discourse" already exists

```

it’s my first installation in the server, but i have rebuild app many times of falure with other errors like [My server can access github, but docker can’t - #2 by whitewaterdeu](https://meta.discourse.org/t/my-server-can-access-github-but-docker-cant/267470/2)

i don’t know when i have created the database and how to fix it

---

_[View the full topic](https://meta.discourse.org/t/createdb-error-database-creation-failed-error-database-discourse-already-exists/267614)._
