Here’s the situation, you, client, webmaster, pet or whoever was playing with users and roles in your favorite store and deleted only main admin account or broke admin account privileges. If it happened to you and you’re locked out from your Magento store, read on.
This script creates new admin user associated to new Inchoo role with all privileges set. Of course, you have to have FTP access for this to work.
Download newadmin script, unpack it, open newadmin.php file (notepad will do) and define username, email and password of the new user. Username and email must be UNIQUE in Magento, so use some new ones and not the old ones that are already in the system, you’ll change it later after you login.
Connect with FTP and copy newadmin.php file to root of your store and run it through web browser like
http://www.yourstore.com/newadmin.php
The script will try to delete itself after user is created, but please make sure it’s removed from the server. Code is tested on 1.3.x versions of Magento and I don’t believe it will work on older versions, so please write some feedback.
Regards
出处:http://inchoo.net/ecommerce/magento/locked-out-from-magento-admin/