<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
oscar lopez escribió:
<blockquote cite="mid:E1HPLEf-0007sw-N8@arkanian.h3m.com" type="cite">
<pre wrap="">Buenos dias, estes el primer mensaje que envio a la lista , estoy siguiendo el curso de mysql y al crear una tabla me aparece un erro 150 y no me deja crear la tabla , todo pare ser por colocarle engine=InnoDB .
mysql> CREATE TABLE telefonos3 (
-> numero CHAR(12),
-> id INT NOT NULL,
-> KEY (id),
-> FOREIGN KEY (id) REFERENCES personas (id)
-> ON DELETE RESTRICT ON UPDATE CASCADE )
-> ENGINE=InnoDB;
</pre>
</blockquote>
Oscar, cuando necesites un poco de info sobre la descripción de "errno"
puedes usar la utilidad `perror`<br>
He probado tu SQL en mi mysql server (5.2.3-falcon-alpha-community)..
sin tener `personas` creado y sale el mismo errno.<br>
<br>
nanox@aioros:~> perror 150<br>
MySQL error code 150: Foreign key constraint is incorrectly formed.<br>
<br>
luego he creado la tabla `personas` para probar.<br>
<br>
CREATE TABLE `personas` (<br>
`id` int(11) NOT NULL,<br>
PRIMARY KEY (`id`)<br>
) ENGINE=InnoDB;<br>
<br>
ejecute de nuevo tu SQL "sin hacer ningún cambio" y corre perfectamente.<br>
<ol>
<li>fíjate si tu MySQL server tiene activado el soporte para InnoDB.<br>
</li>
<li>si la tabla `personas` ya existe.</li>
<li>que el PRIMARY KEY de `personas` sea el campo `id` ( mysql>
describe `personas`; )<br>
</li>
</ol>
<blockquote cite="mid:E1HPLEf-0007sw-N8@arkanian.h3m.com" type="cite">
<pre wrap="">las anteriores las he podido crear bien, no se que pasa, gracias por su colaboracion</pre>
</blockquote>
de las anteriores parece que no tienes `personas`<br>
<br>
<br>
<font size="-1"><font face="Segoe UI">Saludos,<br>
</font></font><font size="-1"><font face="Segoe UI"><br>
</font></font><b>JOSÉ LEONARDO ÁLVAREZ LÓPEZ</b><br>
Chief Executive Officer<br>
Nanosoft, Inc<br>
<pre id="line1">M$-Window$ Re-Boot
GNU/Linux Be Root
n@nOx <span class="moz-smiley-s4"><span> :-P </span></span>
Linux Registered User #437621
Ubuntu User #11953<font color="#666666"><b>
</b></font></pre>
<font face="Segoe UI"><font color="#999999"></font></font><br>
</body>
</html>