# How can I directly edit Discourse database from a GUI?

**URL:** https://meta.discourse.org/t/how-can-i-directly-edit-discourse-database-from-a-gui/138520
**Category:** Self-hosting
**Created:** [January 14, 2020, 4:44am UTC](https://meta.discourse.org/t/how-can-i-directly-edit-discourse-database-from-a-gui/138520 "2020-01-14T04:44:58Z")
**Posts on this page:** 1
**Showing post:** 19

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [May 14, 2020, 8:06pm UTC](https://meta.discourse.org/t/how-can-i-directly-edit-discourse-database-from-a-gui/138520/19 "2020-05-14T20:06:02Z")

</div>

I find that for most actions it’s easier and a bit safer to access the rails console rather than directly interact with the database.

Or, if what you want to do is change a user’s password (oh, that’s not what you were trying to do, but this is still a fine example), do

```plaintext
cd /var/discourse
./launcher enter app
rake admin:create

```

In spite of it’s name, that rake task will allow you to do

- create a user (but it’s fine if the user exists)
- change the password (but you don’t have to)
- make the user an admin (but you don’t have to).

Have a look at [Administrative Bulk Operations](https://meta.discourse.org/t/administrative-bulk-operations/118349) for some other examples.

But here are a few:

```plaintext
users=User.all
me=User.find_by_username ('pfaffman')
me=User.find_by_email('jay@literatecomputing.com')
UserEmail.create!(user: me, email: myotheraddress@somewhereelse.com')
posts_with_uploads=Post.where("raw like '%upload%' ")
Group.create(
  name: "mygreatgroup",
  automatic_membership_email_domains: 'literatecomputing.com',
  primary_group: true,
  title: "Literate Computing Staff",
  grant_trust_level: 4,
  flair_url: 'https://example.com/path.icon.png'
)

```

---

_[View the full topic](https://meta.discourse.org/t/how-can-i-directly-edit-discourse-database-from-a-gui/138520)._
