Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
This page may be helpful: Using MyQSL in batch mode.

There are arguments to the mysql command line utility like: > mysql -e "source batch_file", where batch_file is a file with SQL batch commands in it. So what you may need to do is something like... system("mysql -e source $db_load_file");?

In other words, there are things that the mysql command line utility can do that are outside of the SQL spec and you might just need to use Perl to execute a shell command rather than using DBI.

Does this not work because DBI doesn't really encapsulate all the commands of the mysql command line? That could be right! If so, just run the shell command from Perl. Once the DB has been created, fire up DBI, connect to it and away you go!

This part: That would make sense but then how can I accomplish this without scp'ing the file over and running a system command via ssh? does confuse me as you say that the file is already in both locations already! But with the mysql command line, you can log-on to a remote host with the -h option and use your local version of "batch_file".

shell> mysql -h host -u user -p < batch_file Enter password: ********
So I would suggest reading the link I posted above, get what you want to have happen working manually with you typing the shell commands in, then if you can't get Perl to do everything you want in an "automagic" way, check back in and I'm sure you will get lots of help on how to get the last 10% working!

In reply to Re: Restore Database With DBI? by Marshall
in thread Restore Database With DBI? by kurt2439

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (12)
    As of 2014-09-19 11:24 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (135 votes), past polls