• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Linux Command (PhPMyAdmin)

Sir Gabriiel

New Member
Joined
Mar 24, 2012
Messages
88
Reaction score
2
When I was running the command in PhPMyAdmin:
TRUNCATE `killers`

Error:
#1701 - Cannot truncate a table referenced in a foreign key constraint (`otserv`.`environment_killers`, CONSTRAINT `environment_killers_ibfk_1` FOREIGN KEY (`kill_id`) REFERENCES `otserv`.`killers` (`id`))

And when I was running the command:
TRUNCATE `player_deaths`

Error:
#1701 - Cannot truncate a table referenced in a foreign key constraint (`otserv`.`killers`, CONSTRAINT `killers_ibfk_1` FOREIGN KEY (`death_id`) REFERENCES `otserv`.`player_deaths` (`id`))

The command TRUNCATE `environment_killers` has been executed and not functioned

How do I fix?
 
Last edited:
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE `killers`;
TRUNCATE `player_deaths`;
SET FOREIGN_KEY_CHECKS=1;

or

DELETE FROM `killers`;
ALTER TABLE `killers` AUTO_INCREMENT = 1;
DELETE FROM `player_deaths`;
ALTER TABLE `player_deaths` AUTO_INCREMENT = 1;
Its pretty close to the same operation, but delete is slightly more resourceful which does not matter in this case.
 
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE `killers`;
TRUNCATE `player_deaths`;
SET FOREIGN_KEY_CHECKS=1;

or

DELETE FROM `killers`;
ALTER TABLE `killers` AUTO_INCREMENT = 1;
DELETE FROM `player_deaths`;
ALTER TABLE `player_deaths` AUTO_INCREMENT = 1;
Its pretty close to the same operation, but delete is slightly more resourceful which does not matter in this case.

Thaanks Dude!!
 
Back
Top