From 8d0a3fcf1e0cac7c71929d2896a2263d553eebe3 Mon Sep 17 00:00:00 2001 From: abenmiloud Date: Thu, 22 Aug 2019 09:41:37 +0200 Subject: [PATCH] Ajouter cas erreur 1217 --- HowtoMySQL/Troubleshooting.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/HowtoMySQL/Troubleshooting.md b/HowtoMySQL/Troubleshooting.md index 46fd9c4a..fd617a6a 100644 --- a/HowtoMySQL/Troubleshooting.md +++ b/HowtoMySQL/Troubleshooting.md @@ -772,4 +772,23 @@ mysql> SHOW GLOBAL VARIABLES LIKE '%recover_options%'; ~~~ Cela signifie que lorsqu'une table est réparé, si le résultat diffère, MySQL fait une backup. -Plus d'informations sur la [documentation](https://dev.mysql.com/doc/refman/5.5/en/server-options.html#option_mysqld_myisam-recover-options). \ No newline at end of file +Plus d'informations sur la [documentation](https://dev.mysql.com/doc/refman/5.5/en/server-options.html#option_mysqld_myisam-recover-options). + +## Erreur 1217 + +~~~ +MariaDB [(none)]> drop database `db_name`; +ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails +~~~ + +Pour contourner ce problème on peut faire : + +~~~ +MariaDB [(none)]> SET FOREIGN_KEY_CHECKS=0; +Query OK, 0 rows affected (0.00 sec) +MariaDB [(none)]> drop database `db_name`; +Query OK, 1 row affected (0.00 sec) + +MariaDB [(none)]> SET FOREIGN_KEY_CHECKS=1; +Query OK, 0 rows affected (0.00 sec) +~~~ \ No newline at end of file