Re: Can not add foreign key constraint

2017-04-28 Thread David Mehler
te statements come from your create >>>> scripts >>>> or from a show create table statement? I'm suspicious about the >>index on >>>> virtual_users(user). >>>> >>>> >>>> - Original Message - >>>&g

Re: Can not add foreign key constraint

2017-04-27 Thread Johan De Meersman
tements come from your create >>> scripts >>> or from a show create table statement? I'm suspicious about the >index on >>> virtual_users(user). >>> >>> >>> - Original Message - >>>> From: "David Mehler" >>

Re: Can not add foreign key constraint

2017-04-27 Thread David Mehler
rs(user). >> >> >> - Original Message - >>> From: "David Mehler" >>> To: "MySql" >>> Sent: Tuesday, 25 April, 2017 23:07:19 >>> Subject: Re: Can not add foreign key constraint >> >>> Hello, >>&g

Re: Can not add foreign key constraint

2017-04-25 Thread David Mehler
>>> >>>>>> Here's the output. I hope it helps.

Re: Can not add foreign key constraint

2017-04-24 Thread Peter Brawley
gt; PRIMARY KEY (`user`), -> FOREIGN KEY (user) REFERENCES virtual_users(user) ON DELETE CASCADE -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ERROR 1215 (HY000): Cannot add

Re: Can not add foreign key constraint

2017-04-24 Thread David Mehler
LT CURRENT_TIMESTAMP ON >>>> UPDATE CURRENT_TIMESTAMP, >>>&g

Re: Can not add foreign key constraint

2017-04-24 Thread David Mehler
; UPDATE CURRENT_TIMESTAMP, >> -> PRIMARY KEY (`user`), >> -> FOREIGN KEY (user) REFERENCES virtual_users(user) ON DELETE >> CASCADE >> -> ) ENGINE=InnoDB DEFAULT

Re: Can not add foreign key constraint

2017-04-24 Thread David Mehler
-> PRIMARY KEY (`user`), -> FOREIGN KEY (user) REFERENCES virtual_users(user) ON DELETE CASCADE -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ERROR 1215 (HY000): Cannot add foreign key constraint root@localhost [mail]&

Re: Can not add foreign key constraint

2017-04-24 Thread Peter Brawley
-> `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -> PRIMARY KEY (`user`), -> FOREIGN KEY (user) REFERENCES virtual_users(user) ON DELETE CASCADE -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ERROR 1215 (HY000): C

Re: Can not add foreign key constraint

2017-04-24 Thread shawn l.green
On 4/24/2017 2:10 PM, Peter Brawley wrote: On 4/24/2017 12:28, David Mehler wrote: ...snip Adding in a dummy Create Table for the missing referenced `virtual_domains`, we have ... drop table if exists lastauth, virtual_users, virtual_domains; CREATE TABLE virtual_domains ( id int PRIMA

Re: Can not add foreign key constraint

2017-04-24 Thread David Mehler
T EXISTS `lastauth` ( >>>> -> `user` varchar(40) NOT NULL, >>>> -> `remote_ip` varchar(18) NOT NULL, >>>> -> `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON >>>> UPDATE CURRENT_TIMESTA

Re: Can not add foreign key constraint

2017-04-24 Thread Peter Brawley
ser) ON DELETE CASCADE -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ERROR 1215 (HY000): Cannot add foreign key constraint For the table it's referencing here it is: CREATE TABLE `virtual_users` ( `id` int(11) NOT NULL auto_increment, `domain_id` int(11) NO

Re: Can not add foreign key constraint

2017-04-24 Thread David Mehler
; `remote_ip` varchar(18) NOT NULL, >>-> `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON >>UPDATE CURRENT_TIMESTAMP, >>-> PRIMARY KEY (`user`), >>-> FOREIGN KEY (user) REFERENCES virtual_users(user) ON DELETE >> CASCADE >>

Re: Can not add foreign key constraint

2017-04-24 Thread Peter Brawley
RROR 1215 (HY000): Cannot add foreign key constraint For the table it's referencing here it is: CREATE TABLE `virtual_users` ( `id` int(11) NOT NULL auto_increment, `domain_id` int(11) NOT NULL, `user` varchar(40) NOT NULL, `password` varchar(32) NOT NULL, `quot

Re: Can not add foreign key constraint

2017-04-24 Thread David Mehler
` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -> PRIMARY KEY (`user`), -> FOREIGN KEY (user) REFERENCES virtual_users(user) ON DELETE CASCADE -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ERROR 1215 (HY000): Cannot add foreign key cons

Re: Can not add foreign key constraints

2017-04-24 Thread Peter Brawley
On 4/24/2017 9:18, David Mehler wrote: Hello, I'm trying to add a table to an existing database. I'm wanting it to get one of it's fields from an already existing table. I've done this before in this database. This works: CREATE TABLE `virtual_users` ( `id` int(11) NOT NULL auto_inc

Re: Can not add foreign key constraints

2017-04-24 Thread Reindl Harald
Am 24.04.2017 um 16:18 schrieb David Mehler: I'm trying to add a table to an existing database. I'm wanting it to get one of it's fields from an already existing table. I've done this before in this database. This works: CREATE TABLE `virtual_users` ( `id` int(11) NOT NULL auto_inc

Can not add foreign key constraints

2017-04-24 Thread David Mehler
Hello, I'm trying to add a table to an existing database. I'm wanting it to get one of it's fields from an already existing table. I've done this before in this database. This works: CREATE TABLE `virtual_users` ( `id` int(11) NOT NULL auto_increment, `domain_id` int(11) NOT NULL, `u

RE: how to add foreign key in alter command

2009-05-17 Thread abdulazeez alugo
> Date: Sun, 17 May 2009 14:25:55 +0800 > From: nathan.vorbei.t...@gmail.com > To: mysql@lists.mysql.com > Subject: how to add foreign key in alter command > > Hi guys > Please tell me the command syntax, how to add a colmmen foreign key in > alter syntax > thanks

how to add foreign key in alter command

2009-05-16 Thread Nathan Huang
Hi guys Please tell me the command syntax, how to add a colmmen foreign key in alter syntax thanks -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org

Re: Add foreign key

2007-01-09 Thread Mungbeans
doing wrong before. Obviously the walk I took did me the world of good. -- View this message in context: http://www.nabble.com/Add-foreign-key-tf2950373.html#a8252094 Sent from the MySQL - General mailing list archive at Nabble.com. -- MySQL General Mailing List For list archives:

Re: Add foreign key

2007-01-09 Thread Mungbeans
Just found this added the name: ALTER TABLE `mytable` ADD FOREIGN KEY `fk_mytable_id` ( `id` ) REFERENCES `othertable` ( `id` ); I thought I had tried that - obviously not. -- View this message in context: http://www.nabble.com/Add-foreign-key-tf2950373.html#a8251427 Sent from the MySQL

Add foreign key

2007-01-09 Thread Mungbeans
Still on the top of foreign keys :) I have this statement: ALTER TABLE `mytable` ADD FOREIGN KEY ( `id` ) REFERENCES `othertable` ( `id` ); Is there a way I can give this key a specific name (eg 'FK_mytable_id') and specific the type of reference (eg 'ON UPDATE CASCADE

Re: ERROR 1005 during add foreign key

2004-01-05 Thread Steve Folly
On 5 Jan 2004, at 21:10, Sid Lane wrote: on mysql 4.0.14-standard (x86 Linux) when I try the following: alter table child_table add ( foreign key (column1, column2) references parent_table on delete cascade) ; on an existing innodb table I get: ERROR 1005: Can't create table './d

ERROR 1005 during add foreign key

2004-01-05 Thread Sid Lane
on mysql 4.0.14-standard (x86 Linux) when I try the following: alter table child_table add ( foreign key (column1, column2) references parent_table on delete cascade) ; on an existing innodb table I get: ERROR 1005: Can't create table './dbname/#sql-70f5_b92.frm' (errno: 1