# 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:** 1

<div class="post-metadata">

**Author:** ![paultaylor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paultaylor/32/166024_2.png) [@paultaylor](https://meta.discourse.org/u/paultaylor)\
**Post date:** [December 19, 2019, 5:15pm UTC](https://meta.discourse.org/t/how-to-create-a-new-user-in-pure-sql/136525/1 "2019-12-19T17:15:39Z")

</div>

What are the minimum required tables that require rows to be added to create user, so is then visible active in discourse

Ive just inserted one row into user\_emails

`insert into user_emails (user_id, email, "primary", created_at, updated_at) values (2,'user@email.com',true, now(), now());`

Unsuprisingly has not appeared in the gui, but what are the minimum steps, do I need to add to some more tables, or is there some restart I need to do.

Now I expect someone will say this is not the right ways to do things, and I understand that, but for me it might be as I’ll explain below (some of my assumptions may be incorrect but this is my understanding)

- All the import scripts that import from another database based forum expect to be able to connect to the other forum from the discourse instance. But being able to access the other forum (jforum) from live discourse instance is going to be difficult if not impossible, similarly trying to install a discourse dev environment where by old forum resides (very old server) is also not possible.
- I dont understand Ruby on Rails so I cant modify the existing scripts, but I do understand SQL
- I could use the API (I only have 5000 users) but I want to be able to plugin/method that keep the md5 password hash rather than requiring all users to reset their passwords so I don’t think I can do this using the API
- There is a jforum import script so I can use that to look at the SQL required to get data out of jforum no problem to then put into csv files to load into database.
- The bulk importers possibly provide the way to add SQL into discourse but struggling to see the SQL.
- Seems getting the users in is the key thing, then adding categories, topics and posts should not be so hard.

---

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