Create Admin Account from Console

(Renis) #10

Once you are inside the container, execute the following command:

 rake admin:create RAILS_DB=discourse 

a prompt will come up asking, email, password and if you want to add admin privileges or not…


How to get admin access when using the Vagrant install?
(Alessio Fattorini) #14

@techAPJ you saved my life with this :slight_smile: thank you very much!

(Brian Mc Gonagill) #15

When I try this, I get a bit of an error as well, but it says the following.

Do you want to grant Admin privileges to this account? (Y/n)  
rake aborted!
ActiveRecord::RecordInvalid: Validation failed: Name must be at least 6 characters

Any help is greatly appreciated.

(Jeff Atwood) #16

There is the issue, right there.

(Brian Mc Gonagill) #17

Thanks @codinghorror. I saw that message, but I don’t know what name it refers to. I am following the instructions in this guide and entering the email address of the members I wish to make admins.

I am only prompted for email addresses (which are much more than 6 characters). I then select ‘n’ for changing their pasword, and press Enter as instructed here.

(Brian Mc Gonagill) #18

Nevermind, found the answer here SOLVED: Unable to Grant Admin or Grant Moderator to existing users

(Ken) #19

This is not working for me, I am having email issues and was hoping this would allow my admin user to log in and possibly get access to more useful debugging info. Currently, I am locked out due to not receiving activation mails.

I have a multi-site setup. I do:

./launcher enter app
rake admin:create RAILS_DB=my_site_db
User with this email already exists! Do you want to reset the password for this email? (Y/n)  y
Repeat password:  

Ensuring account is active!

Account updated successfully!
Do you want to grant Admin privileges to this account? (Y/n)  y

Your account now has Admin privileges!

But when I try to log in, I am denied with

 You can't log in yet. We previously sent an activation email to you at Please follow the instructions in that email to activate your account. Click here to send the activation email again.

Is this the correct way to activate a user when activation mail is not sending? Is this the correct way to activate a user for a specific site in a multisite setup?


(Sam Saffron) #20

Are you running multisite ? what is the deal with RAILS_DB=my_site_db ?

(Ken) #21

Yes, multisite - I am using RAILS_DB=my_site_db to point to the site-specific database, as suggested by renis above (possibly not correct, but I also did the same without this option, with the same results). Possibly relevant, the database is not in a container, but running on my host - discourse seems to connect to it without issue.

Basically I am stuck unable to log in and not receiving email - I was planning a separate, detailed post about the email problem, but was just hoping to be able to log in an perhaps get more debugging information (will the web UI give me access to anything not in the production logs in /var/www/discourse/logs in the container?)

Anyway, thanks, any help or advice is appreciated.

(Sam Saffron) #22

You have an ordering issue, rails db is before rake

(Ken) #23

I thought that looked odd - but just tried

RAILS_DB=my_site_db rake admin:create

and got the same results.

Poking around in the database, the active flag for my user on this site database was set to false - setting it to true in psql did not fix the issue, but led me to look around at other databases, where I noticed that my user exists in the ‘primary’ (id 1) site’s database (presumably from a previous admin:create attempt), and is active there. I wasn’t planning to use that site immediately, and was concentrating on one of several other sites I have set up in multisite.yaml.

Logging in to that primary site works for my user without an activation email, and the dashboard there tells me that SideKiq is not running, which probably explains a lot of other things.

Conclusion: There are many moving parts.

Thanks again for your time.

(Ian White) #25

Hi kennric,

I’m attempting a similar setup to you. I have a multisite setup, but can’t seem to select the 2nd site for running the rake tasks.

Did you ever figure this out?

(Ian White) #26

I figured out what I was doing wrong. You need to specify the database config key (in multisite.yml) rather than the database name. For example, if your multisite.yml is:

  database: f2_discourse

then the command to add an admin is:

RAILS_DB=forum2 rake admin:create

(John Kennedy) #27

Thank you very much!

(xXAlphaManXx) #28

It is good that i was able to create one from the above commands, but how can i exit the app? i mean, how can i go back to the root of my system. Is there any commands like ./laucher exit app ?

(cpradio) #29

No, just type exit and hit enter.


I have installed discourse on godaddy cloud servers via bitnami.

What is the equivalent command of “cd /var/discourse” for me ?


My admin account has email set as and I am not able to change the email. so i am not getting email in my inbox (off course because does not exist)

Nothing is working, password reset is also use less now.

There is no way to edit email from admin panel.

(Felix Freiberger) #32

The Discourse team can only support the official Docker-based install here – I’d highly recommend that you re-install Discourse using these instructions.


I followed your instruction and now feeling better because things are going smoother than before.