Magento admin login problem after fresh installation

By Avinash

October 03, 2010Tips & Tricks3 Comments

Recently I have started learning Magento. It’s just amazing. I have faced one interesting problem today with Magento.

Problem:

The problem is, I have just installed magento on my machine, after installation front end work fine, but I can not login to the magento admin panel even with correct username and password. It not even given error for this but redirecting to the same page. And if I enter wrong username and password it will give Wrong username / password error. It seems like that you have proper credential but magento just not allowing you to let into the admin panel.

I was wondered that magento is a very big community and it’s a very fast growing shopping cart open source code, it must not have this type of bug.

Solution:

There are several solutions for these, but I will post here which is most works for most of developers.

1)  replacing localhost with 127.0.0.1

If you have installed you magento on localhost and trying to access like http://localhost/magento .

But due to standard restriction browser don’t save cookies for domains with no dots in domain name. So I suggest you to access your magento using http://127.0.0.1/magento, this will work. This works even for me.

For this solution, if you have installed your magento using localhost, then you have to make some alteration in database tables.

You have to replace localhost with 127.0.0.1 in core_config_data table.

User below query to find the rows which have localhost entered:

Select * from core_config_data where value LIKE ”%localhost%”
Select * from core_config_data where value LIKE ”%localhost%

You will get two rows, you just have to update these two rows from localhost to 127.0.0.1.

You can use below query to update these two rows:

UPDATE core_config_data SET value = http://127.0.0.1/ WHERE path IN (‘web/unsecure/base_url’,’ web/secure/base_url’);
UPDATE core_config_data SET value = http://127.0.0.1/ WHERE path IN (‘web/unsecure/base_url’,’ web/secure/base_url’);

I hope you will place proper values in above queries suitable for you.

2)  Editing the virtual host file

If you are on windows machine then you can change you host file to locate localhost to some other domain which have at least single dot (.) in it.

You can find the this file at below path:

C:\WINDOWS\system32\drivers\etc
C:\WINDOWS\system32\drivers\etc

In this folder there must one file called hosts, in this file you can point localhost or 127.0.0.1 to some domain like http://www.localmagento.com

Hope this post will helpful for you, waiting for your responses.

Share This Article