8

I have a database that I built a while back. Every table in the database is InnoDb. Several tables had foreign key constraints, and I set them up for On Delete = Cascade. When I was using an earlier version of phpmyadmin, working with these was simple: I'd just go to the Structure tab of a table, click the Relation View link, and as long as I had the correct indexes set up on the correct columns, I could set the foreign keys as I saw fit.

Since upgrading to version 4, it's become a nightmare. For some tables, I go to the relation view and everything is just fine. But for others--even when they already have foreign key constraints set--I can't see any options for working with them.

To make matters worse, I've even tried dropping the indexes and re-adding them, only to be given the following error: Cannot drop index [index_name]: needed in a foreign key constraint. So unless I'm mistaken, the constraint is there, but phpmyadmin is refusing to show it to me.

Is there something I have to do to make them show up again? This is extremely frustrating to say the least: something that worked just fine before now does not thanks to an upgrade.

1
  • I just checked the table KEY_COLUMN_USAGE in the information_schema table. It confirms that there's a foreign key constraint. I want to change this, but again, phpmyadmin won't show me the constraints. It really makes me want to downgrade to the older version... Sep 2, 2014 at 6:14

4 Answers 4

16

OK, after playing around with the tables a bit, I figured out what's going on. The only time the foreign key constraint options don't show up are when the table names contain capital letters. Very frustrating to say the least.

7
  • This has been the source of immense frustration for me for the past few weeks. I wish google had led me to this long ago, rather than other more standard issues in enabling issues in phpmyadmin. Oct 8, 2014 at 8:36
  • Yeah, I wound up going back and changing all the camel cased tables to underscore names. Oct 8, 2014 at 13:14
  • 2
    No way! It's so frustrating we lose all this time looking for such a tiny detail. Worst thing is phpmyadmin says nothing about it! Dec 14, 2014 at 3:49
  • I think worse is that it's not compliant with allowed table names. They had a similar bug with a different error that kept popping up if you used an upper case table name, and they fixed that, but apparently not others. I'm having to roll back to an older phpMyAdmin until all these capitalization triggered bugs are fixed.
    – Charles
    May 27, 2015 at 8:48
  • Wow, I thought I was going mad, but it turns out this is the fix, mind you I am posting this almost a year later and this bug is still around.
    – Gerard
    Jul 28, 2015 at 20:11
1

I just filed a bug report for phpmyadmin: https://github.com/phpmyadmin/phpmyadmin/issues/11461

It should be an easy fix.

1
  • Thank you for this. I think a lot of people will be very happy once this gets resolved. Sep 4, 2015 at 12:18
0

happened to me because i used '&" in the database name.

0

In my case it is that I used two columns (A and B) both as foreigns keys to other tables then I also used a composite unique for ([A, B]), phpMyAdmin does not show the existed foreign index of column A but does show that for column B. My system version are as follows: Server version: 5.7.30 - MySQL Community Server (GPL)

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.