2

I am able to login to the admin control panel the first time and when I logout and login again it get this message:

There has been an error processing your request SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY', query was: INSERT INTO `admin_user_session` (`session_id`, `user_id`, `status`, `ip`) VALUES (?, ?, ?, ?)

But this works again when I get the empty ADMIN_USER_SESSION table in PHPMyAdmin.

0

MAKE SURE YOU HAVE A DB BACKUP

You can verify that your admin_user_session table has the primary key set to auto-increment with this query:

SELECT `AUTO_INCREMENT` FROM  INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA 'magento_db' AND TABLE_NAME = 'admin_user_session';

If you see that auto-increment is turned off, then you can fix it with this query:

ALTER TABLE 'admin_user_session' MODIFY COLUMN 'session_id' INT NOT NULL AUTO_INCREMENT;

However, if you need to do that, that is a good indication that either your DB import failed or you have some custom functionality with admin sessions that is blocking the auto-increment functionality.

0

Run below query your issue get resolved.

ALTER TABLE `admin_user_session` MODIFY COLUMN 'session_id' INT AUTO_INCREMENT;
0

CODE USED:

SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA 'magento_db' AND TABLE_NAME = 'admin_user_session' LIMIT 0, 25 MySQL said: Documentation

ERROR CODE:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''magento_db' AND TABLE_NAME = 'admin_user_session' LIMIT 0, 25' at line 1

And when i tried to ALTER:


CODE USED: ALTER TABLE 'admin_user_session' MODIFY COLUMN 'session_id' INT NOT NULL AUTO_INCREMENT;

ERROR CODE:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''admin_user_session' MODIFY COLUMN 'session_id' INT NOT NULL AUTO_INCREMENT' at line 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.