Direct SQL insertion of Magento admin

Written by Peter Davies on .

A while back we needed a way of getting an admin user setup quickly on a newly migrated 3rd party Magento store, using the following we were able to setup a new admin account within a matter of seconds.

insert into magento_admin_user
select (select max(user_id) + 1 from magento_admin_user) user_id,
'First' first_name, 'Last' last_name,
This email address is being protected from spambots. You need JavaScript enabled to view it.' email,
'qwerty' username, MD5('qwerty') password,
now() created, NULL modified, NULL logdate, 0 lognum, 0 reload_acl_flag, 1 is_active,
(select max(extra) from magento_admin_user where extra is not null) extra, NULL, NULL;

insert into magento_admin_role
select
(select max(role_id) + 1 from magento_admin_role) role_id,
(select role_id from magento_admin_role where role_name = 'Administrators') parent_id,
2 tree_level, 0 sort_order, 'U' role_type, (select user_id from magento_admin_user where username = 'qwerty') user_id,
'qwerty' role_name