This happens when the cookie domain in the following directory is different from the actual site domain
System -> configuration -> Web. The on the main content goes to “Session cookie management”.
All the above parameters can be tweaked according to the user needs
There are three solutions to this problem;
Use these commands in PHPMyAdmin;
DELETE FROM core_config_data WHERE path=’web/cookie/cookie_domain’;
DELETE FROM core_config_data WHERE path=’web/cookie/cookie_path’;
Now try to log in.
Delete Var folder:
Delete everything from the var folder and then check whether it is working or not.
Replace .htaccess file:
Replace the .htaccess file with sample .htaccess file and try to log in to the admin folder.
Check your admin role Database table against a backup. The data can be erased due to the database server crash.
Then as soon as you can log in to the system again. Set the correct cookie domain for each website or store.
For example; .example.com for example.com, www.example.com, and all other subdomains.
If you are using the n98-magerun, then the same functionality can be accomplished with;
n98-magerun config:delete web/cookie/cookie_domain
n98-magerun cache:clean config
I hope this will help to solve your problem.