Skip to content

Instantly share code, notes, and snippets.



Last active Mar 16, 2020
What would you like to do?
## get n98-magerun2
curl -o /usr/local/bin/magerun2
## reset magento admin password
MAGE_NEW_ADMIN_PASS="$(head -c 500 /dev/urandom | tr -dc 'a-zA-Z0-9!@#$%^&?=+_[]{}()<>-' | fold -w 15 | head -n 1)${RANDOM}"
read -e -p "---> Enter admin old login: " -i "admin" MAGE_OLD_ADMIN_NAME
read -e -p "---> Enter your First Name: " -i "Name" MAGE_NEW_ADMIN_FNAME
read -e -p "---> Enter your Last Name: " -i "Lastname" MAGE_NEW_ADMIN_LNAME
read -e -p "---> Enter admin login: " -i "admin" MAGE_NEW_ADMIN_NAME
read -e -p "---> Enter admin email address: " -i "" MAGE_NEW_ADMIN_EMAIL
## delete admin
/usr/local/bin/magerun2 admin:user:delete ${MAGE_OLD_ADMIN_NAME} -f
## create new admin
bin/magento admin:user:create --admin-user='${MAGE_NEW_ADMIN_NAME}' --admin-password='${MAGE_NEW_ADMIN_PASS}' \
--admin-email='${MAGE_NEW_ADMIN_EMAIL}' --admin-firstname='${MAGE_NEW_ADMIN_FNAME}' --admin-lastname='${MAGE_NEW_ADMIN_LNAME}'
echo " > Magento admin login: ${MAGE_NEW_ADMIN_NAME}"
echo " > Magento admin password: ${MAGE_NEW_ADMIN_PASS}"
echo " > Magento admin email: ${MAGE_NEW_ADMIN_EMAIL}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.