Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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?


Comment on Re: Restore Database With DBI?
Select or Download Code
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://928911]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2014-08-31 10:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (294 votes), past polls