# 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:** 5

<div class="post-metadata">

### Author: ![nicolas\_ferrer](https://avatars.discourse-cdn.com/v4/letter/n/ba8739/32.png) [@nicolas\_ferrer](https://meta.discourse.org/u/nicolas_ferrer)
#### Post date: [July 13, 2023, 1:55pm UTC](https://meta.discourse.org/t/createdb-error-database-creation-failed-error-database-discourse-already-exists/267614/5 "2023-07-13T13:55:17Z")

</div>

Did you can to solve this problem? I have a similar error.

```plaintext

I, [2023-07-12T20:27:26.203859 #1] INFO -- : > su postgres -c 'createdb discourse' || true
2023-07-12 20:27:26.398 UTC [55] postgres@postgres ERROR: database "discourse" already exists
2023-07-12 20:27:26.398 UTC [55] postgres@postgres STATEMENT: CREATE DATABASE discourse;
createdb: error: database creation failed: ERROR: database "discourse" already exists
I, [2023-07-12T20:27:26.423480 #1] INFO -- : 
I, [2023-07-12T20:27:26.423858 #1] INFO -- : > su postgres -c 'psql discourse -c "create user discourse;"' || true
2023-07-12 20:27:26.599 UTC [59] postgres@discourse ERROR: role "discourse" already exists
2023-07-12 20:27:26.599 UTC [59] postgres@discourse STATEMENT: create user discourse;
ERROR: role "discourse" already exists

```

Our script was working normally…

---

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