Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3350770
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:49:38+00:00 2026-05-18T01:49:38+00:00

MySQL is giving me grief when I try to recreate a particular table in

  • 0

MySQL is giving me grief when I try to recreate a particular table in a particular database; I believe the problem is that somewhere MySQL has some records of the table’s foreign keys and keeps trying to check the constraint when I try to recreate the table.

The database in question is for the test environment and is periodically refreshed by dumping the prod DB, dropping the test DB, creating the test DB again and then applying the prod DB dump to the new test DB.

However last night when I went to do this procedure I suddenly ran into MySQL’s errno: 121, which is normally related to an incorrect foreign key… If I try with a different table defnition, without specifying a key, I get errno: 150 instead. However, this only occurs if I try to apply the dump to a new database of exactly the same name as the old one. If I create a database with a different name from the old one (on the same server still) and apply the dump, there is no problem.

In fact, I can’t even create a table of exactly the same name without any keys at all even in a completely new database.

This example demonstrates the problem

mysql> create database test_db;
Query OK, 1 row affected (0.01 sec)

mysql> connect test_db;
Connection id:    1590
Current database: test_db

mysql> create table client_feed_group(id int);
ERROR 1005 (HY000): Can't create table './test_db/client_feed_group.frm' (errno: 150)
mysql> create database new_db_name;
Query OK, 1 row affected (0.00 sec)

mysql> connect new_db_name;
Connection id:    1591
Current database: new_db_name

mysql> create table client_feed_group(id int);
Query OK, 0 rows affected (0.01 sec)

I have already dropped the test_db database; this should remove all table and all records. I then create it, connect to it and try to create the old table client_feed_group; I get an error. I create another database with a different name and follow the same steps; this time there is no problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T01:49:39+00:00Added an answer on May 18, 2026 at 1:49 am

    It appears to be the same as this MySQL bug.

    The procedure located far down in the comments worked for me, that is

    • create the table again using the same schema as the old one, but using a MyISAM engine
    • use ALTER TABLE to change the engine to innodb

    thereafter things appear to work correctly; I can now drop the database and do a full restore with no problems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

MySQL has this incredibly useful yet proprietary REPLACE INTO SQL Command. Can this easily
MySQL specifies the row format of a table as either fixed or dynamic, depending
MySQL 5.0.45 What is the syntax to alter a table to allow a column
Can MySql 5.0 views use tables that are located on another server? What is
I have a PHP codebase that was written to address our MySQL tables in
I'm inserting some data into a database from a form. I'm using addslashes to
In the following code, the header: line is giving problem. $q = mysql_query($a) or
I'm giving emacs a try for the first time and I was wondering if
I have a MySQL database I'm able to connect via the command prompt and
I have a code to create VIEW in mysql database which is working fine

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.