[Cialug] MySQL Backup parsing

Barry Von Ahsen vonahsen at gmail.com
Fri Sep 21 22:20:28 UTC 2018


This scenario is when I changed to --skip_extended_insert

Makes the file a bit bigger, but then you can grep/head/tail a diff restore
:)

-barry



On Fri, Sep 21, 2018, 14:12 kristau <kristau at gmail.com> wrote:

> Indeed, I didn't take the "Little Bobby Tables" case into account. . .
> https://xkcd.com/327/
> On Fri, Sep 21, 2018 at 1:30 PM David Champion <dchamp1337 at gmail.com>
> wrote:
> >
> > I'll throw Ken off by making a bunch of tables called "mytable insert
> into
> > 1" ...
> >
> > It would be really easy to script what Andrew was talking about: import
> > into a temp database, run some count queries, then drop the temp
> database.
> > You can do "mysql (parameters) < mycommands.sql", where mycommands.sql
> > contains "select count(id) from mytable".
> >
> > See also:
> https://dev.mysql.com/doc/refman/8.0/en/mysql-batch-commands.html
> >
> > -dc
> >
> > On Fri, Sep 21, 2018 at 1:19 PM kristau <kristau at gmail.com> wrote:
> >
> > > Since the output from mysqldump is just plain text and "records" would
> > > appear within that file as INSERT INTO statements, perhaps something
> > > like the following might work?
> > >
> > >   grep -i 'insert into' backupfile.sql | wc -l
> > >
> > > I may be drastically oversimplifying this, though. . .
> > >
> > > A very interesting question and problem.
> > > On Fri, Sep 21, 2018 at 10:04 AM Andrew Denner <linux-list at upeke.com>
> > > wrote:
> > > >
> > > > The easiest way I know of is to do a restore onto a non prod
> environment
> > > > and then do a count from there...
> > > >
> > > > On Thu, Sep 20, 2018 at 8:08 PM L. V. Lammert <lvl at omnitec.net>
> wrote:
> > > >
> > > > > Anyone ever played with a way to do a simple record count by db
> and/or
> > > > > table in a backup? We have a server with a DB backup that shrunk
> over
> > > a GB
> > > > > in the past few days for no known reason.
> > > > >
> > > > >         Lee
> > > > > _______________________________________________
> > > > > Cialug mailing list
> > > > > Cialug at cialug.org
> > > > > http://cialug.org/mailman/listinfo/cialug
> > > > >
> > > > _______________________________________________
> > > > Cialug mailing list
> > > > Cialug at cialug.org
> > > > http://cialug.org/mailman/listinfo/cialug
> > >
> > >
> > >
> > > --
> > > Tired programmer
> > > Coding late into the night
> > > The core dump follows
> > > _______________________________________________
> > > Cialug mailing list
> > > Cialug at cialug.org
> > > http://cialug.org/mailman/listinfo/cialug
> > >
> > _______________________________________________
> > Cialug mailing list
> > Cialug at cialug.org
> > http://cialug.org/mailman/listinfo/cialug
>
>
>
> --
> Tired programmer
> Coding late into the night
> The core dump follows
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug
>


More information about the Cialug mailing list