<p>I've recently been working with a MySQL database, and using MySQL workbench to design the Database.</p>

<p>When I use the export to SQL function, so I can actually get the layout in to the Database, I get:</p>

<blockquote>
  <p>"Error 1005: Cannot create table"</p>
</blockquote>

<p>This appears to be related to Foreign Keys in the create table statement.</p>

<p>Does anybody have a work around for this that doesn't involve taking the constraints out and putting them back in later?  That's a less than ideal solution given the size of the database.</p>

[{'answer_id': 34642, 'author': 'joev', 'author_id': 3449, 'author_profile': 'https://Stackoverflow.com/users/3449', 'pm_score': 1, 'selected': False, 'text': '<p>I ran into this situation recently when I attempted (in InnoDB tables) to make a foreign key reference to a column that had a different data type.</p>\n\n<p><a href="http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html" rel="nofollow noreferrer">MySQL 5.1 Documentation</a></p>\n'}, {'answer_id': 34713, 'author': 'Tom Mayfield', 'author_id': 2314, 'author_profile': 'https://Stackoverflow.com/users/2314', 'pm_score': 3, 'selected': False, 'text': "<p>When you get this (and other errors out of the InnoDB engine) issue:</p>\n\n<pre><code>SHOW ENGINE INNODB STATUS;\n</code></pre>\n\n<p>It will give a more detailed reason why the operation couldn't be completed.  Make sure to run that from something that'll allow you to scroll or copy the data, as the response is quite long.</p>\n"}]
['https://Stackoverflow.com/questions/34579', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/655/']