MySQL Error 121 During CREATE TABLE

23 Nov 2009

I’m using MySQL to track a pile of data for a project at work. This is a one-off kind of thing that will probably be thrown away after I finish this project, but, I still try to make sure that I have a solid, yet simple, DB design. So, while iterating my way to having just the bits I need, I ran into:

$ >mysql -p database_name <filename.sql
Enter password: ***************
ERROR 1005 (HY000) at line 86: Can't create table database_name.table_name'(errno: 121)

A little Googling lead to several totally different explanations, which are things that I tried. What finally fixed it for me was the advice that I found at [ ]. The SELECT statement for listing the foreign key names didn’t work on MySQL 5.1.40-community on Windows (yes, I know that 5.1.41 is out, I’ll get to it later). However, I did have a couple of tables that were using the same name for a foreign key pointing at the same third table. So, error 121 means a duplicate foreign key name somewhere in the database. Foreign key names must be unique across the entire database, not just within a given table.


9 Oct 2009

One thing that has bothered me for years is when people refer to SQL but pronounce it as “sequel.” There is a different database language called SEQUEL. They are not the same thing. They are both database languages, but pretty much have nothing else in common.

I first remember hearing SQL mispronounced as “sequel” from Microsoft back in the 1990′s shortly after a release of Microsoft SQL Server. I can not say with certainty that Microsoft did this on purpose in order to spit in IBM’s eye, but if you search for IBM sequel database language (for example, on Google), you’ll see that Microsoft still advertises that you can “Learn Sequel”.

Please, people, can you pronounce SQL as S-Q-L? After all, IBM invented both SEQUEL and SQL and they said that this is the correct pronunciation. Thank you :) .