Common errors

  • This section covers the usual errors you may get while using the MySQL Workbench application.
  • Errors will be divided in two categories:
    • Errors received in Forward engineer operation while importing the data model into the database.
    • Errors received when running queries into selected database (for these errors please see the action output window).

Errors with Forward engineer operation

Error number 150: "Foreign key constraint is incorrectly formed"

  • Possible cause: The datatype in the source field and target field is different when creating connection between two tables (usually when primary key value is used in foreign key field in another table).

  • Solution: Check that both fields have common datatype (for example INT or VARCHAR). See the example image below.

Example for error 150

Error number 121: "Duplicate key on write or update"

  • Possible cause: Same foreign key name used in two or more connections.

  • Solution: Check all connections where one primary key value is used in two or more tables. See the example image below.

Example for error 121

Errors when running queries

Error Code 1146: "Table X doesn't exist"

  • Possible cause: Table name is miswritten in syntax or table with given name does not exist in selected database.

  • Solution: Recheck that table with given name exists in the database and that its written correctly in the syntax.

Example for error 1146

Error Code 1064: "You have an error in your SQL syntax"

  • Possible cause: SQL has invalid syntax.

  • Solution: Check the structure of the syntax and that it has all the parts in correct order.

Example for error 1064

Error Code 1052: "Column X in field list is ambiguous"

  • Possible cause: At least one of the selected columns is present in two or more tables and database management system cannot decide the table where that column will be selected.

  • Solution: Use the following notation for column selection: table_name.column_name.

Example for error 1052