On woensdag 3 december 2003 22:56 Andrew Braithwaite told the
butterflies: 
> You could try to use the "select into {OUTFILE | DUMPFILE}
> from tablename where blah=blah..."
> 
> I think you may be able to do "select into local outfile from
> blah...." 
> 
> Which will put the file on the same server as the MySQL
> client is running on...
> 
> Cheers,
> 
> Andrew
> 
> -----Original Message-----
> From: Matt Babineau [mailto:[EMAIL PROTECTED]
> Sent: Wednesday 03 December 2003 17:37
> To: [EMAIL PROTECTED]
> Subject: RE: Query to emulate what mysqldump does
> 
> 
> On Wed, 2003-12-03 at 15:22, Jay Blanchard wrote:
> > [snip]
> > I thought about that Jay, but the mysql server is not on the
> > webserver machine. Any other suggestions? [/snip]
> > 
> > phpmyadmin will allow you to connect to the remote MySQL server and
> > do dumps
> 
> What if I don't have phpmyadmin available? :)
> 
> What I am trying to do, it setup a simple script to pull down
> essentially a backup of their database and write it to a file on my
> development machine so when they mess up their data (..and I said
> WHEN) I can be a hero and revert them to the last good backup before
> they "didn't touch a thing". 
> 

As I understand, you've got a box of your own. With MySQL installed. Since
the database is on another server as the website, there is a fair chance
that you can just connect to it from your local box. 

 > mysql -u <user> --host <host> [--port <port>] -p
        and
 > mysqldump -u <user> --host <host> [--port <port>] -p <databaes> [<table>]

Or, if you insist on doing this through your own little php script, might
wanna try this:

$Tables = mysql_query('SHOW TABLES');
while($Table = mysql_fetch_assoc($Tables)) {
        $Rows = mysql_select('SELECT * FROM '.$Table['Tables_in_<dbname>']);
        while($Row = mysql_fetch_assoc($Rows)) {
                // Here you've got your tables. For each and every
                // table again. Do whatever you want with it...
        }
}

(but I'd personally just stick to phpMyAdmin)




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to