2
I have 'problem' in my Wamp, more precisely in the latest version (Wampserver 3.0.6 64 bit x64).
When I create 2 tables, example:
CREATE TABLE categoria(
id_categoria INT NOT NULL AUTO_INCREMENT,
nome VARCHAR(100) NOT NULL,
PRIMARY KEY(id_categoria)
);
CREATE TABLE chamado(
id_chamado INT NOT NULL AUTO_INCREMENT,
id_categoria INT NOT NULL,
titulo VARCHAR(45) NOT NULL,
PRIMARY KEY(id_chamado),
FOREIGN KEY(id_categoria) REFERENCES categoria(id_categoria)
);
Running and creating the tables, however, Phpmyadmin does not automatically create the relationship between the foreign key and the primary key of the other table, things that with XAMP work automatically.
I need to automatically create the relationship between the tables, even so I can use Mysql with Hibernete (happens with Hibernete also).
I think it might be some configuration, someone would know how to solve?
Thanks in advance.
-----------> Updating:
Insert into table Called through Phpmyadmin:
As much as the category table has records, I can add any id in the foreign key of the called table that no error occurs. Things that, using Xamp, works, which relates the two tables and opens an option with the foreign key id at Insert time.
Check if the problem you are having is not Storage Engine
– DNick
Even specifying foreign keys, I can do Inserts without referencing, deleting, and nothing returns error.
– Agnaldo Junior
@Agnaldojunior, you tried to do like Dnick said, it would be something like
ALTER TABLE nome_da_tabela ENGINE=INNODB
, or in phpMyadmin in Operations > table options, and change the Storage Engine– David
I tried to do this, but it didn’t solve it. I updated the post by adding more details.
– Agnaldo Junior