SQL

Создать пользователя с паролем и дать доступ к базе

CREATE DATABASE IF NOT EXISTS my_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'new_user'@'localhost' IDENTIFIED BY 'new_password';
GRANT ALL ON my_db.* TO 'new_user'@'localhost';
FLUSH PRIVILEGES;

Найти пользователей без профиля

SELECT * FROM `auth_user` 
  WHERE not EXISTS (SELECT * FROM userprofile_userprofile WHERE userprofile_userprofile.user_id=auth_user.id );
SELECT * FROM `auth_user` 
WHERE id NOT IN (SELECT user_id FROM userprofile_userprofile)
ORDER BY `id`  ASC    

Удалить пользователей без профиля

DELETE FROM `auth_user` 
  WHERE not EXISTS (SELECT * FROM userprofile_userprofile WHERE userprofile_userprofile.user_id=auth_user.id );