dumping sql result not properly reference

55 views Asked by At

by the way : its about last years ago, i didnt have the device now , i do backup but didnt test because usually its work as well. if i remember that i use tools heidsql on kali linux.

these code on line 40

  KEY `FK_catalogue_kategori` (`kategori_name_kategori`),
  CONSTRAINT `FK_catalogue_kategori` FOREIGN KEY (`kategori_name_kategori`) REFERENCES `kategori` (`name_kategori`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=85 DEFAULT CHARSET=utf8mb4;

these code on line 120

-- Dumping structure for table db_malang.kategori
DROP TABLE IF EXISTS `kategori`;
CREATE TABLE IF NOT EXISTS `kategori` (

my dump.sql have more than 44.2045 lines of code

what i expected i can import but... if we looking the above its possible to import because the dump code will run on first line than the second lines , am i right ?

because every time i tried to import its say Query 5 ERROR: Failed to open the referenced table 'kategori'

anyone have solution or tricky ? or any generator or like beautify or ugly method for re-structure dump file sql for make it change on order/execture first on table instead of table where have the foreign key, so make sql file execute table first where didnt have foreignkey thats mean priority on table without foreignkey while importing .

-- --------------------------------------------------------
-- Host:                         127.0.0.1
-- Server version:               10.5.8-MariaDB-3 - Debian buildd-unstable
-- Server OS:                    debian-linux-gnu
-- HeidiSQL Version:             10.1.0.5535
-- --------------------------------------------------------

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;

in database

-db_malang
---catalogue // have kategori_id
---kategori

the heidsql dump just from top to bottom.

0

There are 0 answers