0

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.

Yogi Arif Widodo
  • 563
  • 6
  • 22
  • 1
    Please [edit] your question to include the exact command on how you build the mysqldump file. Also show the result of the mysqldump file without the `INSERT INTO` statements (since that would be 44k lines). – Progman Apr 15 '22 at 12:09
  • hard to show the result because there is private db ( private sensitive data ) and schema structure. can you share about how to delete all `insert into` on exist .sql file only ? whole world/pattern/for refactor ? – Yogi Arif Widodo Apr 15 '22 at 16:53
  • Which program do you use to generate the mysqldump file? The "mysqldump" program has a `--no-data` option you can use, see https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html#option_mysqldump_no-data. If you use any other program check the documentation of that program. – Progman Apr 15 '22 at 19:35

0 Answers0