# Create an admin account from the console

**URL:** https://meta.discourse.org/t/create-an-admin-account-from-the-console/17274
**Category:** Self-Hosting
**Tags:** how-to
**Created:** [July 6, 2014, 2:42pm UTC](https://meta.discourse.org/t/create-an-admin-account-from-the-console/17274 "2014-07-06T14:42:40Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [July 6, 2014, 2:42pm UTC](https://meta.discourse.org/t/create-an-admin-account-from-the-console/17274/1 "2014-07-06T14:42:40Z")

</div>

> 🔖 This guide provides instructions for creating an admin account or granting admin privileges using the console in a self-hosted Discourse installation.
> 
> 🙋 Required user level: System Administrator  
> ⚠ Console access required

So you want to create/grant Admin privileges or reset user password from console? Great, let’s get started!

This guide will cover the following:

- Accessing the console
- Creating a new account with admin privileges
- Resetting an existing password
- Granting admin privileges to an existing account
- Multisite configuration instructions

## Accessing the console

Connect to your Discourse server using SSH, or use [Putty](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) if you’re on Windows:

```plaintext
ssh root@your.server.ip

```

Replace `your.server.ip` with the actual IP address of your server.

Switch to your Discourse directory:

```plaintext
cd /var/discourse

```

Enter the Docker container:

```plaintext
./launcher enter app

```

## Creating a new account with admin privileges

Inside the console, run the following command:

```shell
rake admin:create

```

You will be prompted for:

- **Email**
- **Password**
- **Repeat password**

If your site requires a full name at signup (`full_name_requirement` set to `required_at_signup`), you will also be prompted for **Full name**.

A new account will be created with a username based on the email address. You’ll see: “Account created successfully with username {username}”. When asked if you want to grant admin privileges, press **Enter** to confirm.

If successful, you’ll see: “Your account now has Admin privileges!”

> **Instructions for multisite**
>
> If you have a multisite configuration you’ll run:
> 
> ```
> RAILS_DB=my_site_db rake admin:create 
> 
> ```

## Resetting the password for an existing account

To reset a password, execute the same command:

```shell
rake admin:create

```

Enter the email of the existing account. If the user exists, you will be asked if you want to reset the password. Press **Enter** to proceed. Provide and confirm the new password.

If it worked, you’ll see _Account updated successfully!_.

## Granting admin privileges to an existing account

Run this command from console:

```
rake admin:create

```

You will be asked for _Email_, enter the email of existing account.

Now you will be asked: `User with this email already exists! Do you want to reset the password for this email? (Y/n)`. Press n then enter.

Now you will be asked: `Do you want to grant Admin privileges to this account? (Y/n)`. Press enter to continue.

If it worked, you’ll see _Your account now has Admin privileges!_.

## Multisite configuration instructions

For multisite setups, prepend the commands with `RAILS_DB=multisite_name`, where `multisite_name` corresponds to the top line of your multisite configuration:

Example configuration:

```yaml
mysite:
  adapter: postgresql
  database: database2
  password: secret
  pool: 25
  host: data
  host_names:
    - mysite.example.com

```

Command:

```shell
RAILS_DB=mysite rake admin:create

```

> Last edited by @SaraDev 2024-11-15T00:04:38Z
> 
> > **Check document**
> >
> > Perform check on document:

---

_[View the full topic](https://meta.discourse.org/t/create-an-admin-account-from-the-console/17274)._
