Skip to content

Instantly share code, notes, and snippets.

@vukanac
Forked from tridungpham/new_gist_file.sql
Last active June 15, 2020 11:21
Show Gist options
  • Save vukanac/ea9307f280976f0417fc074fca910878 to your computer and use it in GitHub Desktop.
Save vukanac/ea9307f280976f0417fc074fca910878 to your computer and use it in GitHub Desktop.
Create new admin user in Magento 1.9
export MAGE_FIRST_NAME="Peter"
export MAGE_LAST_NAME="Pan"
export MAGE_USERNAME="peter.pan"
export MAGE_PASS="topsecret1234"
make query QUERY="INSERT INTO admin_user SELECT NULL user_id, '$MAGE_FIRST_NAME' firstname, '$MAGE_LAST_NAME' lastname, '[email protected]' email, '$MAGE_USERNAME' username, MD5('$MAGE_PASS') password, NOW() created, NULL modified, NULL logdate, 0 lognum, 0 reload_acl_flag, 1 is_active, NULL extra, NULL rp_token, NOW() rp_token_created_at;"
make query QUERY="INSERT INTO admin_role SELECT NULL role_id, (SELECT role_id FROM admin_role WHERE role_name = 'Administrators') parent_id, 2 tree_level, 0 sort_order, 'U' role_type, (SELECT user_id FROM admin_user WHERE username = '$MAGE_USERNAME') user_id, '$MAGE_USERNAME' role_name;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment