Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Browse a SQL-Dump file without importing it into a DBMS?

Tags:

sql

mysql

viewer

Is somebody aware of a tool that lets me browse MySQL-Files without having to import them into my database system? I'm looking for an easy way to inspect MySQL Backups quickly without having to import them - but still being nicely displayed, so viewing the SQL source is not really an option.

Maybe there's a program that takes the SQL dump and automatically imports it into a temporary database, then presenting it in an interface similar to HeidiSQL (or any other SQL-Gui-Tool).

like image 777
klickreflex Avatar asked Oct 18 '10 13:10

klickreflex


People also ask

Where can I find SQL dump file?

The memory dump is stored in the SQL instance MSSQL\LOG\ directory by default.

Where are MySQL dump files stored?

The mysqldump tool is located in the root/bin directory of the MySQL installation directory.


2 Answers

Why are you eliminating the obvious solution? You just need to load the backup into a mysql database. Either load the backup into a separate mysql instance, or if your backup is of just one database (i.e. you didn't pass --databases or --all-databases to mysqldump), load it into a database of a different name.

like image 64
Keith Randall Avatar answered Oct 12 '22 22:10

Keith Randall


I came here looking for an answer to the same question, because it can be cumbersome to wait to load a 20 GB sql dump just for inspection and drop again. While I hope to find a standalone shortcut tool, best I can recommend is a cocktail of linux cli text manipulation tools like grep, sed, and cut. Some useful output could be:

  • What tables are being created/inserted into?
  • Are the mysqldump INSERTs one line-per-record or all stuffed into one? (Because this can affect other things like)
  • How many rows are being inserted into table XYZ?
  • What is some representative data being inserted into table XYZ?
  • What is the ABC column value for the last row inserted into table XYZ?

Good luck!

like image 24
texas-bronius Avatar answered Oct 12 '22 23:10

texas-bronius