
Magento 1.x – Create a new backend admin user from database
If you need to create a new backend admin user, you can use the following database script:
1 2 3 4 5 6 7 |
LOCK TABLES `admin_role` WRITE , `admin_user` WRITE; INSERT INTO `admin_user` (firstname,lastname,email,username,password,created,lognum,reload_acl_flag,is_active,rp_token_created_at) VALUES ('Firstname','Lastname','email@example.com','myuser',MD5('mypassword'),NOW(),0,0,1,NOW()); INSERT INTO `admin_role` (parent_id,tree_level,sort_order,role_type,user_id,role_name) VALUES (1,2,0,'U',(SELECT user_id FROM admin_user WHERE username = 'myuser'),'Firstname'); UNLOCK TABLES; |
Instead, if you just need to change the password of an existing user, you can do the following:
1 |
UPDATE admin_user SET password = MD5('newpassword') WHERE username = 'myuser'; |
Then remember to clean cache and try to access with your new user.
Note: if you are being redirected to the same login page, take care of your web/cookie/cookie_domain value in the core_config_data table.