So why can’t you login to Magento admin panel?

Localhost

One of the reasons that you have a login problem is that you are trying to access your website through localhost. First of all Magento checks host name in the real domain and then creates cookie. If the name is not correct, Magento just can’t create cookie.

If you are using a remote Web server, it is unlikely that this problem occurs.

But note: if you are using remote webserver, this problem would not appear.

Cookie

If you have just moved your website to a new place, the problem can be in browser. You should  remove Magento cache (only for back-end) and clean your browser cookie.

The other reason that you are not able to login Magento admin panel can be settings and configurations in Magento. To change the settings you should open MySQL Database. Look in your database for table core_config_data and find field web/cookie/cookie_domain. There could be multiple entries, but attribute scope_id set to 0 should contain your domain name for Magento.

Secure/unsecure URL-addresses

Here you should check URLs in the same table core_config_data. To avoid this this problem find web/secure/base or web/unsecure/base line and check if your host name is correct.

If not, Magento is trying to redirect to your previous host name. So check if the host name matches to name in the browser address bar.

Removing old and set new ones

Instead of setting up correct values in the MySQL database manually, you can delete old ones with the help of SQL-queries:

DELETE * FROM `core_config_data` WHERE `path` = "web/cookie/domain";
DELETE * FROM `core_config_data` WHERE `path` LIKE "web/secure/base%";
DELETE * FROM `core_config_data` WHERE `path` LIKE "web/unsecure/base%";

File permissions

Folder var/cache that you have in your Magento installation should allow recording. If it is not, nobody will be able to login to Magento admin panel due to new session files can’t be created.

Save session in database

Instead of checking access to files, you can store them in a database. You can do it in local.xml. Before, please create Magento backup or make sure that it is exists.

Find the line <session_save> and modify it like shown in the picture. Replace the word “file”:

<session_save><![CDATA[files]]></session_save>

with the word “db”:

<session_save><![CDATA[db]]></session_save>

Save the file.

After all the things you’ve checked and done you should be able to login to your Magento admin panel. And don't forget about secure login!