4
I have two tables, one call aluno
and another call HistoricoAluno
. After creating them, a change was missing which was to leave the primary key of the table alunos
as auto_increment
. By trying to make that change I always get the following error:
Query error:
#1833 - Cannot change column 'idAluno': used in a foreign key constraint 'historicoaluno_ibfk_1' of table 'matriculas.historicoaluno
So I tried some solutions, like this:
SET FOREIGN_KEY_CHECKS = 0;
/* realizar as alterações */
SET FOREIGN_KEY_CHECKS = 1;
But I did not succeed. How can I leave the table primary key alunos
as auto_increment
?
I am using mysql in phpMyAdmin.
Both tables (or any of them) have records?
– KaduAmaral
Before I tried to insert in the table of students, and I could only insert when I informed the id (different from those who had there). Now they’re both off the books and I still can’t make the change.
– DiChrist