I built a site with Craft 3 in 2018. I have barely touched it since (or worked with Craft, to be honest). The front-end is fine and the end-users have been using it without problem until last week when they contacted me because they suddenly could not login to the back-end. I too cannot login. The login page is showing an Internal Server Error message. I have temporarily set ENVIRONMENT=“dev” in the .env file to see what the error message is. What I am seeing is:

PHP Notice – yiibaseErrorException
Undefined index: constraint_name
1. in /home/customer/www/cornerstonebooks.co.uk/vendor/yiisoft/yii2/db/mysql/Schema.php   at line 387 

etc. etc.

I have absolutely no idea what that means or, more importantly, how to troubleshoot/fix it. Any suggestions as to how to go about fixing the problem, would be gratefully received.



1 Answer 1


Assuming you're running Craft version 3.4.27 or earlier, most likely your web host has updated MySQL and you're running into this issue: https://github.com/craftcms/cms/issues/6379

The fix is to update Craft to 3.4.28 or later (for security reasons; ideally to the latest 3.9.x release or even to Craft 4 as Craft 3 is EOL as of April 2024). Alternatively, you'll need to ensure MySQL is using a version prior to 8.0.21, or move to MariaDB.

  • Hi Mats, That makes sense. My hosting provider swore that they hadn't changed anything on the server when I contacted them about this the other day, but I bet they have (ggrrhh). I'll check it out tomorrow (it's gone midnight here in the UK). Thanks Philip Commented Jul 3 at 23:23
  • 1
    Hi Mats, you were EXACTLY right. My hosting provider had (without warning) updated MySQL to 8.0.36. The site is now working again. Again, thankyou very much – there’s no way I would have been able to figure the problem out on my own. Philip Commented Jul 4 at 21:43
  • @PhilipBuckley Awesome that I could help out! Hope you got it sorted, one way or the other :) Commented Jul 6 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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