Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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]
and the monks are chillaxin'...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2018-01-20 17:55 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (227 votes). Check out past polls.