# Different CLI commands to get to the database

**URL:** https://meta.discourse.org/t/different-cli-commands-to-get-to-the-database/79341
**Category:** Support
**Created:** [January 30, 2018, 4:16am UTC](https://meta.discourse.org/t/different-cli-commands-to-get-to-the-database/79341 "2018-01-30T04:16:49Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [January 30, 2018, 4:16am UTC](https://meta.discourse.org/t/different-cli-commands-to-get-to-the-database/79341/1 "2018-01-30T04:16:49Z")

</div>

On my localhost development I have two ways to get to the database. In common is

```plaintext
cd /var/discourse
sudo ./launcher enter app --skip-prereqs

```

\* the --skip-prereqs is because autoclean, autoremove and launcher cleanup fail to clean up enough room for some reason that I haven’t determined yet and I can’t enter app without it.

I can then either

```plaintext
exec rails db

```

or

```plaintext
su -c 'psql discourse' postgres

```

Though there are some obvious differences - the prompt and the exit level - it appears that they are essentially the same.

I would like to know if there are any differences that are not obvious to me. In particular, is one inherently “safer” than the other? Would one trigger / queue jobs and the other not?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [January 30, 2018, 7:58am UTC](https://meta.discourse.org/t/different-cli-commands-to-get-to-the-database/79341/2 "2018-01-30T07:58:14Z")

</div>

I don’t think there’s any difference between the 2 command except that `rails db` will always work even if/when the db is renamed.

Also it’s shorter, so less typing 😉

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 8, 2024, 12:43pm UTC](https://meta.discourse.org/t/different-cli-commands-to-get-to-the-database/79341/3 "2024-06-08T12:43:26Z")

</div>

This topic was automatically closed after 2321 days. New replies are no longer allowed.
