How to Create Admin User by database in Magento?

To create admin user from database in Magento you can do this by using the following script. With this code one can create magento admin user in the database and login to the Magento admin panel with right credentials.


Magento Create New Admin User with SQL Script

Just copy paste this code in the database and then you will be able to login the Magento admin dashboard area respectively.

INSERT INTO `admin_user` (
`user_id`,`firstname`,`lastname`,`email`,`username`,`password`,`created`,`modified`,`logdate`,`lognum`,`reload_acl_flag`,`is_active`,`extra`,`rp_token`,`rp_token_created_at`)
VALUES (NULL , 'admin', 'admin', 'admin@gmail.com', 'admin', MD5( '1q2w3e' ) ,
CURRENT_TIMESTAMP , NULL , NULL , '0', '0', '1', NULL , NULL , NULL
)

INSERT INTO admin_role SELECT
NULL `role_id`,0 `parent_id`,2 `tree_level`,0 `sort_order`,'U' `role_type`,
(SELECT `user_id` FROM admin_user WHERE `username` = 'admin') `user_id`,
'Administrators' `role_name`;

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *