mysql-error-1005

Error When creating a foriegn key

Hello, I'm getting this error when trying to add a foreign key contraint: #1005 - Can't create table './testtable/#sql-595_146.frm' (errno: 150) I need to do an ON DELETE CASCADE for all images that share a project id when that project is deleted. My simplified table structure is as follows: CREATE TABLE IF NOT EXISTS `images` ( `im...

MySQL: Why doesn't this db creation script work?

For some reason, this MySQL fails: CREATE SCHEMA IF NOT EXISTS `partB` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ; USE `partB`; CREATE TABLE Employees ( ssn CHAR(11), Name CHAR(30), mlot INTEGER, PRIMARY KEY(ssn)) ENGINE = InnoDB; CREATE TABLE Dept_Mgr ( did INTEGER, dname CHAR(20), ssn CHAR(11) NOT NULL, PRIMARY KEY (did...

Cannot mySQL share a foreign key between tables?

Hi everyone, I get error 1005 when inserting my tables. There's multiple tables referencing to the tables in my design made up in mySQL workbench, but doesn't this work? - a shared foreign contraint among several tables? Table one is called languages. It has a id column for each language in the database. Then we have productDescription...

Error No 150 mySQL

Hi all. This is making me sweat - I am getting error 150 when I try and create a table in mySQL. I've scoured the forums to no avail. The statement uses foreign key constraints - both tables are InnoDB, all relevant columns have the same data type and both tables have the same charset and collation. Here's the CREATE TABLE and the origin...

Mysql: ERROR 1005 (HY000): Can't create table 'receitascakephp.recipes' (errno: 150)

CREATE TABLE `users` ( `id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT, `name` VARCHAR(255) NOT NULL, `username` VARCHAR(75) NOT NULL, `password` VARCHAR(75) NOT NULL, `image` VARCHAR(255) ); CREATE TABLE `recipes` ( `id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT, `name` VARCHAR(255) NOT NULL, `method` TEXT NOT NULL, ...

DB Error on create - Errno 150

When running the follow query i receive the error below, Im just trying to create this simple table with no FK or anything and still receive this error. What could be the cause? SQL query: CREATE TABLE `xauction`.`orders` ( `id` INT( 11 ) NOT NULL AUTO_INCREMENT , `type` VARCHAR( 1 ) NOT NULL , PRIMARY KEY ( `id` ) ) ENGINE = InnoDB; ...

MySQL Error Code: 1005

I am trying to add foreign keys to my table but receiving this error. Error Code: 1005 Can't create table 'william.#sql-88c_3' (errno: 150) I have 3 tables. employee, client and Contract. employe [employee_no PK] , Client[customer_no PK] contract [contract_no PK] I want to have Foreign keys for contract as contract [contract_no PK, empl...

error code 1005 error number 121 on 3 tables what am I doing wrong?

code: SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL'; CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ; -- Table mydb.SEX CREATE TABLE IF NOT EXISTS `my...

MySql: Simple Problem with Creating Tables & Foreign Keys

Hello people, I have problems with creating tables & foreign key. (errno:150) here is a screenshot Updated Image: http://img264.imagevenue.com/img.php?image=14866_db_122_223lo.jpg Maybe the problem is the database design. -- ----------------------------------------------------- -- Table `mydb`.`projekt_user` -- -----------------------...

mysql simple problem with foreign keys

I have two tables: Table Author: ID (INTEGER), author_name (VARCHAR), first_name (VARCHAR), last_name (VARCHAR), preferred_name (VARCHAR). Table CoAuthored: ID (INTEGER) author1ID (INTEGER), author2ID (INTEGER), paper_ID (INTEGER) (ID of the co-authored paper referenced by this link) I want to add foreign key constraints such that aut...

MySQL: Can't create table (errno: 150)

I am trying to import a .sql file and its failing on creating tables. Here's the query that fails: CREATE TABLE `data` ( `id` int(10) unsigned NOT NULL, `name` varchar(100) NOT NULL, `value` varchar(15) NOT NULL, UNIQUE KEY `id` (`id`,`name`), CONSTRAINT `data_ibfk_1` FOREIGN KEY (`id`) REFERENCES `keywords` (`id`) ON DELETE CASCADE ON...

MySQL Foreign Key Error 1005 errno 150

Hello, I'm doing a small DataBase with MySQL Workbench. I have a main table, called "Immobili", which has a Primary Key composed by four columns: (Comune, Via, Civico, Immobile). Now, I also have three other tables, wich have the same primary key (Comune, Via, Civico, Immobile), but these fields are also referenced to the table Immobili....