Magento cannot log into admin 50


I experienced a problem just after my Magento install where the page would simply redirect back to the login without displaying an error message.  I’d login using the user credentials I just created during the install and I also tried using the default user “admin” with password “123123” .  The trick was that I was installing on localhost and for some reason a cookie was not being set for the session.  I have other sites requiring a cookie on localhost, but Magento seems to have a problem with it.

The solution is to add the following line to your hosts file so you can access your localhost as www.localhost.com.
C:Windows\System32\drivers\etc\hosts (edit this file in notepad)
127.0.0.1 magento.localhost.com www.localhost.com
Also worth mentioning, if you need to reset a password manually in the database use the following:

UPDATE admin_user SET password=MD5(‘mypassword’) WHERE username=‘admin’;

If none of the above works, install the browser Opera and use it. Opera seems to work out of the box whereas IE, Firefox, and Google Chrome do not.


Leave a comment

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

50 thoughts on “Magento cannot log into admin