Search code examples
windowsmariadbdump

Open a MariaDB .Sql dump file in windows


I'm quite new to Database stuff and this looks like a dumb question, but I haven't found an answer online so here I go:

I have a 3Go .sql file, which is a dump from a MariaDB database. I'm on windows with restricted rights, got nothing but DBrowser and DBeaver (community version). I want to be able to see the data in this dump, like tables, columns, and actual entries.

What I've tried so far:

  • Using the "import" option in DBrowser, and it said it worked but it shows me an empty DB and the .db file created is only 8ko.
  • Using DBeaver, but it needs to connect to a DB, and I have nothing to connect to.
  • Opening the file directly with DBeaver; I got an out of memory error.
  • Import the file as script in DBeaver, same error.
  • found some mysql commands online, but I'm on windows so I don't have those.
  • found some info on a "restore db" option in DBeaver, but must be in the pro version because I don't have it.

I've managed to open the file in a text editor, it's full of stuff like this:

--
-- Table structure for table `XXX`
--

DROP TABLE IF EXISTS `XXX`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `XXX` (
  `config` varchar(32) DEFAULT NULL,
  `task_config` varchar(32) DEFAULT NULL,
  `active` tinyint(1) DEFAULT NULL,
  `sys_id` char(32) NOT NULL,
  PRIMARY KEY (`sys_id`),
  KEY `task_config` (`task_config`),
  KEY `config` (`config`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `XXX`
--

set autocommit=0;
INSERT INTO `XXX` VALUES ( YYY )
commit;

So it looks like a valid dump from me? like it delete everything then recreates the table and insert some data?

So, how could I be able to "open" that DB? My last guess is installing MariaDB.msi for windows, makes a connection to localhost and creates an empty database to then import the dump in it, and at least connect to said database with DBeaver; but it looks like a lot of step to just be able to visualize a dump correctly, and since I have restricted rights I would need to ask for authorization, so I wanna be sure it's the right way to do it before I go for it.


Solution

  • Install MySQL Community Server 8.0.

    Install MySQL Workbench 8.0 to create the DB.

    Use MySQL CLI to import database:

    mysql --host="127.0.0.1" --port=3306 --user=[User] --password [Database] < database.sql

    Use Workbench to view data.

    If you want to see data, I think Notepad++ can do the work, never used to open such huge file.