# sudo -u gitlab-psql /opt/gitlab/embedded/bin/psql -h /var/opt/gitlab/postgresql -d gitlabhq_production
or
# gitlab-rails dbconsole --database main
gitlabhq_production=# insert into users (name, username, email, notification_email, projects_limit, state, created_at, confirmed_at) values ('Name Surname', 'userlogin',
After that password can be restored via password recovery procedure.
Set user admin permissions:
gitlabhq_production=# UPDATE users SET admin = 't' WHERE email like
Links:
https://docs.gitlab.com/ee/security/reset_user_password.html