RE: Query to emulate what mysqldump does

2003-12-04 Thread Wouter van Vliet
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  --host  [--port ] -p
and
 > mysqldump -u  --host  [--port ] -p  []

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_']);
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]



RE: Query to emulate what mysqldump does

2003-12-03 Thread Andrew Braithwaite
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".

Thx-
M


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

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



RE: Query to emulate what mysqldump does

2003-12-03 Thread Jay Blanchard
[snip]
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".
[/snip]

Dude...phpmyadmin is free! ;) You can install it on a local server, but
connect to mysql on the remote server(s). I use it to manage several DB
servers including our test farm. Doing a dump is as simple as selecting
some particulars and clicking 'go'.

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



RE: Query to emulate what mysqldump does

2003-12-03 Thread Matt Babineau
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".

Thx-
M


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



RE: Query to emulate what mysqldump does

2003-12-03 Thread Jay Blanchard
[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

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



RE: Query to emulate what mysqldump does

2003-12-03 Thread Matt Babineau
On Wed, 2003-12-03 at 15:13, Jay Blanchard wrote:
> [snip]
> Are there any query equivalencies to mysqldump? I am looking for a way
> to get a complete database dump via php and I don't have access to the
> system CLI to run mysql dump.
> [/snip]
> 
> Run mysqldupmp in a php file using exec...see
> 
> http://www.php.net/exec
> http://www.mysql.com/mysqldump
> 
> looks like
> 
> $foo = exec("mysqldump database [options]");

I thought about that Jay, but the mysql server is not on the webserver
machine. Any other suggestions?

-Matt


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



RE: Query to emulate what mysqldump does

2003-12-03 Thread Jay Blanchard
[snip]
Are there any query equivalencies to mysqldump? I am looking for a way
to get a complete database dump via php and I don't have access to the
system CLI to run mysql dump.
[/snip]

Run mysqldupmp in a php file using exec...see

http://www.php.net/exec
http://www.mysql.com/mysqldump

looks like

$foo = exec("mysqldump database [options]");

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