Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Restore Database With DBI?

by Corion (Pope)
on Sep 30, 2011 at 20:30 UTC ( #928911=note: print w/replies, xml ) Need Help??

in reply to Restore Database With DBI?

I would assume that source FILE is not a valid MySQL command.

Why not read each line from the SQL file and $dbh->do(...) it? You might also be interested in DBIx::RunSQL. Personally, I would just run the mysql binary with the source file, either locally or on the server. Maybe you want to talk to your database administrator on how to achieve this?

Replies are listed 'Best First'.
Re^2: Restore Database With DBI?
by kurt2439 (Sexton) on Sep 30, 2011 at 20:44 UTC

    The SQL file is like 6GB, but I guess as long as I go through the file lines with 'while' and not 'foreach' it wouldn't really use up much memory via perl, right?

    I could do it with mysql binary, but I need this procedure automated. I guess I can create a mysql profile file for that user so it doesn't prompt for a password. We'll see -- I just wanted to know how to keep it all in perl and it seems like you answered that. Thanks!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://928911]
[Corion]: A good daystart to everybody!
[Corion]: Just a quick poll - is anybody actively relying on https://perlmonks. I plan to retire that URL in favour of moving all our servers onto the same HTTPS certificate for perlmonks.{com, net,org}

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (13)
As of 2017-09-26 07:41 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (292 votes). Check out past polls.