# How to create a new user in pure sql

**URL:** <https://meta.discourse.org/t/how-to-create-a-new-user-in-pure-sql/136525>\
**Category:** Migration\
**Created:** [December 19, 2019, 5:15pm UTC](https://meta.discourse.org/t/how-to-create-a-new-user-in-pure-sql/136525 "2019-12-19T17:15:39Z")\
**Posts on this page:** 1\
**Showing post:** 23

<div class="post-metadata">

**Author:** ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)\
**Post date:** [December 22, 2019, 9:52am UTC](https://meta.discourse.org/t/how-to-create-a-new-user-in-pure-sql/136525/23 "2019-12-22T09:52:39Z")

</div>

I wouldn’t advise using the md5 hash as a password, it will be used as the actual password. If you won’t be needing the password field upon user creation, just use a long random string instead.

What I was trying to say is that Discourse will first try to log in the user by matching the password entered by the user with the stored password. Only when that attempt fails, the migratepassword plugin will come into play, and it will try to see if the user supplied password is correct by matching it against the custom field using a number of built-in alternative hashing algorithms (md5 being one of them).

---

_[View the full topic](https://meta.discourse.org/t/how-to-create-a-new-user-in-pure-sql/136525)._
