stevenyang1011
11/15/2017 - 8:58 PM

SQL to add Admin User to Magento 1

SQL to add Admin User to Magento 1

LOCK TABLES `admin_role` WRITE , `admin_user` WRITE;
SET @USER = "username";
SET @PASS = MD5("password");
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 ('Moustache','Republic','deveoper@moustacherepublic.com',@USER,@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 = @USER),'Moustache');
UNLOCK TABLES;