Fixed Knowledge Base

Get all the help you need here.

This is restricted content – not visible to the public.

Adding Magento Admin Users

Posted 18th December, 2018

If you do not have access to the Magento admin area, Magento admin users can be added via the database. Use the following script, replacing every work prefixed with x

LOCK TABLES `admin_role` WRITE , `admin_user` WRITE;
 
SET @SALT = "rp";
SET @PASS = CONCAT(MD5(CONCAT( @SALT , "xpassword") ), CONCAT(":", @SALT ));
SELECT @EXTRA := MAX(extra) FROM admin_user WHERE extra IS NOT NULL;
 
INSERT INTO `admin_user` (firstname,lastname,email,username,password,created,lognum,reload_acl_flag,is_active,extra,rp_token_created_at) 
VALUES ('xFirstname','xLastname','[email protected]','xmyuser',@PASS,NOW(),0,0,1,@EXTRA,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 = 'xmyuser'),'xFirstname');
 
UNLOCK TABLES;