Re: backup question: INSERT statements
At 19:47 -0230 9/28/04, Neil Zanella wrote: Hello, I need to backup a mysql database in such a way that the output is simply a bunch of insert statements. I do not want the database schema as output as well: just the insert statements. This is because I already have a script with CREATE statements and would like to rebuild the database from scratch: since I need to modify the schema and table structure I prefer this approach than using ALTER TABLE, given that the database data size is small and rebuilding from scratch could add some efficiency. So how do I get this with myqldump. I just want the insert statements and the data. mysqldump --help shows: -t, --no-create-info Don't write table creation info. -- Paul DuBois, MySQL Documentation Team Madison, Wisconsin, USA MySQL AB, www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Backup question.
Bernard Clement wrote: rsynch will do the job correctly only and only if the mysql server on both sides are not running. Rsynch does not deal with files opened for writing and my guess is that MySQL is opening the database (i.e. files) for writing. It will work without stopping mysql server if you make sure that all data in memory are flushed to disc and mysql server does not modify these files while you read them. This can be done with: FLUSH TABLES WITH READ LOCK NB: I assume that you run mysql server on main server only (not on backup server). If you have mysql server on both systems you can also use mysql built-in replication : set your main server as master and the backup server as a slave. As for LVM (AKA Logical Volume Manager) I really do not see how it could be used to take a snapshot in MySQL. However, I could be wrong here. MySQL manual describes how to make a snapshot with Veritas filesystem (vxfs). I am sure that it could be done in the same way with LVM (but I haven't tried it myself): "If you are using a Veritas filesystem, you can do: 1. From a client (or Perl), execute: FLUSH TABLES WITH READ LOCK. 2. From another shell, execute: mount vxfs snapshot. 3. From the first client, execute: UNLOCK TABLES. 4. Copy files from snapshot. 5. Unmount snapshot. " (from : http://www.mysql.com/doc/en/Backup.html) Bernard Hope this helps, Joseph Bueno On Tuesday 18 November 2003 05:12, Simon Green wrote: Has any one use LVM to take a snapshot in MySQL and use this to back up data? Simon -Original Message- From: Paco Martinez [mailto:[EMAIL PROTECTED] Sent: 18 November 2003 10:00 To: Christensen, Dave; 'Richard Reina'; [EMAIL PROTECTED] Subject: Re: Backup question. Is there any problem executing "rsync /var/lib/mysql/data/" from one host to another host and therefore having same file in obth machines?? Is it unsafe this method ?? Could be crashed meanwhile transferring ?? Thanks !!! - Original Message - From: "Christensen, Dave" <[EMAIL PROTECTED]> To: "'Richard Reina'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, November 12, 2003 10:20 PM Subject: RE: Backup question. Yes, you can do it like this: Prompt> mysqldump --add-drop-table --host=source.IP.addr.spec -uuser -ppassword databasename | mysql -uuser -ppassword I've found that it helps things if you add --no-data to the source side on the first pass, then remove that clause and run it again. Dave -Original Message- From: Richard Reina [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 12, 2003 3:54 PM To: [EMAIL PROTECTED] Subject: Backup question. I would like to backup databases from a linux MySQL server to another linux machine on the same private network but I don' see in the docs how I can do this with mysqlhotcopy or mysqldump. Is there any way to do this besides using ftp. Any help would be appreicated. Richard -- 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] -- 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: Backup question.
I think that it is more than backing up the database you want to do. If I am right you want to synchronize the 2 databases in which case the answer is replication. Replication is described in the reference manual of MySQL. Bernard On Tuesday 18 November 2003 04:59, Paco Martinez wrote: > Is there any problem executing "rsync /var/lib/mysql/data/" from one host > to another host and therefore having same file in obth machines?? > > Is it unsafe this method ?? > > Could be crashed meanwhile transferring ?? > > Thanks !!! > > - Original Message - > From: "Christensen, Dave" <[EMAIL PROTECTED]> > To: "'Richard Reina'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Wednesday, November 12, 2003 10:20 PM > Subject: RE: Backup question. > > > Yes, you can do it like this: > > > > > > Prompt> mysqldump --add-drop-table --host=source.IP.addr.spec -uuser > > -ppassword databasename | mysql -uuser -ppassword > > > > > > > > I've found that it helps things if you add --no-data to the source side > > on the first pass, then remove that clause and run it again. > > > > Dave > > > > -Original Message- > > From: Richard Reina [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, November 12, 2003 3:54 PM > > To: [EMAIL PROTECTED] > > Subject: Backup question. > > > > > > I would like to backup databases from a linux MySQL server to another > > linux machine on the same private network but I don' see in the docs how > > I can do this with mysqlhotcopy or mysqldump. Is there any way to do > > this besides using ftp. > > > > Any help would be appreicated. > > > > Richard > > > > > > -- > > 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] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Backup question.
rsynch will do the job correctly only and only if the mysql server on both sides are not running. Rsynch does not deal with files opened for writing and my guess is that MySQL is opening the database (i.e. files) for writing. As for LVM (AKA Logical Volume Manager) I really do not see how it could be used to take a snapshot in MySQL. However, I could be wrong here. Bernard On Tuesday 18 November 2003 05:12, Simon Green wrote: > Has any one use LVM to take a snapshot in MySQL and use this to back up > data? > > Simon > > -Original Message- > From: Paco Martinez [mailto:[EMAIL PROTECTED] > Sent: 18 November 2003 10:00 > To: Christensen, Dave; 'Richard Reina'; [EMAIL PROTECTED] > Subject: Re: Backup question. > > > Is there any problem executing "rsync /var/lib/mysql/data/" from one host > to another host and therefore having same file in obth machines?? > > Is it unsafe this method ?? > > Could be crashed meanwhile transferring ?? > > Thanks !!! > > - Original Message - > From: "Christensen, Dave" <[EMAIL PROTECTED]> > To: "'Richard Reina'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Wednesday, November 12, 2003 10:20 PM > Subject: RE: Backup question. > > > Yes, you can do it like this: > > > > > > Prompt> mysqldump --add-drop-table --host=source.IP.addr.spec -uuser > > -ppassword databasename | mysql -uuser -ppassword > > > > > > > > I've found that it helps things if you add --no-data to the source side > > on the first pass, then remove that clause and run it again. > > > > Dave > > > > -Original Message- > > From: Richard Reina [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, November 12, 2003 3:54 PM > > To: [EMAIL PROTECTED] > > Subject: Backup question. > > > > > > I would like to backup databases from a linux MySQL server to another > > linux machine on the same private network but I don' see in the docs how > > I can do this with mysqlhotcopy or mysqldump. Is there any way to do > > this besides using ftp. > > > > Any help would be appreicated. > > > > Richard > > > > > > -- > > 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] > > -- > 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: Backup question.
Just me has access to that machine... And there's no LVM. - Original Message - From: "Simon Green" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, November 18, 2003 11:12 AM Subject: RE: Backup question. > Has any one use LVM to take a snapshot in MySQL and use this to back up > data? > > Simon > > -Original Message- > From: Paco Martinez [mailto:[EMAIL PROTECTED] > Sent: 18 November 2003 10:00 > To: Christensen, Dave; 'Richard Reina'; [EMAIL PROTECTED] > Subject: Re: Backup question. > > > Is there any problem executing "rsync /var/lib/mysql/data/" from one host to > another host and therefore having same file in obth machines?? > > Is it unsafe this method ?? > > Could be crashed meanwhile transferring ?? > > Thanks !!! > > - Original Message - > From: "Christensen, Dave" <[EMAIL PROTECTED]> > To: "'Richard Reina'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Wednesday, November 12, 2003 10:20 PM > Subject: RE: Backup question. > > > > Yes, you can do it like this: > > > > > > Prompt> mysqldump --add-drop-table --host=source.IP.addr.spec -uuser > > -ppassword databasename | mysql -uuser -ppassword > > > > > > > > I've found that it helps things if you add --no-data to the source side on > > the first pass, then remove that clause and run it again. > > > > Dave > > > > -Original Message- > > From: Richard Reina [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, November 12, 2003 3:54 PM > > To: [EMAIL PROTECTED] > > Subject: Backup question. > > > > > > I would like to backup databases from a linux MySQL server to another > > linux machine on the same private network but I don' see in the docs how > > I can do this with mysqlhotcopy or mysqldump. Is there any way to do > > this besides using ftp. > > > > Any help would be appreicated. > > > > Richard > > > > > > -- > > 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] > > > > -- > 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] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Backup question.
Has any one use LVM to take a snapshot in MySQL and use this to back up data? Simon -Original Message- From: Paco Martinez [mailto:[EMAIL PROTECTED] Sent: 18 November 2003 10:00 To: Christensen, Dave; 'Richard Reina'; [EMAIL PROTECTED] Subject: Re: Backup question. Is there any problem executing "rsync /var/lib/mysql/data/" from one host to another host and therefore having same file in obth machines?? Is it unsafe this method ?? Could be crashed meanwhile transferring ?? Thanks !!! - Original Message - From: "Christensen, Dave" <[EMAIL PROTECTED]> To: "'Richard Reina'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, November 12, 2003 10:20 PM Subject: RE: Backup question. > Yes, you can do it like this: > > > Prompt> mysqldump --add-drop-table --host=source.IP.addr.spec -uuser > -ppassword databasename | mysql -uuser -ppassword > > > > I've found that it helps things if you add --no-data to the source side on > the first pass, then remove that clause and run it again. > > Dave > > -Original Message- > From: Richard Reina [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 12, 2003 3:54 PM > To: [EMAIL PROTECTED] > Subject: Backup question. > > > I would like to backup databases from a linux MySQL server to another > linux machine on the same private network but I don' see in the docs how > I can do this with mysqlhotcopy or mysqldump. Is there any way to do > this besides using ftp. > > Any help would be appreicated. > > Richard > > > -- > 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] -- 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: Backup question.
Is there any problem executing "rsync /var/lib/mysql/data/" from one host to another host and therefore having same file in obth machines?? Is it unsafe this method ?? Could be crashed meanwhile transferring ?? Thanks !!! - Original Message - From: "Christensen, Dave" <[EMAIL PROTECTED]> To: "'Richard Reina'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, November 12, 2003 10:20 PM Subject: RE: Backup question. > Yes, you can do it like this: > > > Prompt> mysqldump --add-drop-table --host=source.IP.addr.spec -uuser > -ppassword databasename | mysql -uuser -ppassword > > > > I've found that it helps things if you add --no-data to the source side on > the first pass, then remove that clause and run it again. > > Dave > > -Original Message- > From: Richard Reina [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 12, 2003 3:54 PM > To: [EMAIL PROTECTED] > Subject: Backup question. > > > I would like to backup databases from a linux MySQL server to another > linux machine on the same private network but I don' see in the docs how > I can do this with mysqlhotcopy or mysqldump. Is there any way to do > this besides using ftp. > > Any help would be appreicated. > > Richard > > > -- > 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] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Backup question.
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Richard -- ...and then Richard Reina said... % % I would like to backup databases from a linux MySQL server to another % linux machine on the same private network but I don' see in the docs how % I can do this with mysqlhotcopy or mysqldump. Is there any way to do What about, on machine two, mysqldump -hmachine1 -uuser -ppassword --opt --all-databases > backup or so? % this besides using ftp. Definitely. There's scp, for instance ;-) % % Any help would be appreicated. % % Richard HTH & HAND :-D - -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.7 (FreeBSD) iD8DBQE/tEy5Gb7uCXufRwARAt0OAJ9INCSlHJTSEBUCiwvuhRq1IWpZGgCgtYd+ zP1J+2ryYcQIBSiWlGJq2TU= =eryB -END PGP SIGNATURE- -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Backup question.
Yes, you can do it like this: Prompt> mysqldump --add-drop-table --host=source.IP.addr.spec -uuser -ppassword databasename | mysql -uuser -ppassword I've found that it helps things if you add --no-data to the source side on the first pass, then remove that clause and run it again. Dave -Original Message- From: Richard Reina [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 12, 2003 3:54 PM To: [EMAIL PROTECTED] Subject: Backup question. I would like to backup databases from a linux MySQL server to another linux machine on the same private network but I don' see in the docs how I can do this with mysqlhotcopy or mysqldump. Is there any way to do this besides using ftp. Any help would be appreicated. Richard -- 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: Backup question.
mysqldump -uname -ppassword -BDatabase | mysql -uname -ppasswrod -Ddatabase -hremotehost -Original Message- From: Richard Reina [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 12, 2003 3:54 PM To: [EMAIL PROTECTED] Subject: Backup question. I would like to backup databases from a linux MySQL server to another linux machine on the same private network but I don' see in the docs how I can do this with mysqlhotcopy or mysqldump. Is there any way to do this besides using ftp. Any help would be appreicated. Richard -- 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: Backup Question.
Richard -- You could do both, I would be a lot quicker to import data than restore from tape. Say do an incremental dump back to your last level 0. Which would be helpfull to developers as well as youself. You could also use a seperate partition for the data directory and back that up. The subject of backups falls under the same catagory as: sport,relegion and politics isn't discussed in polite company. Have I confused you yet :) David > I am running mysql on a linux box RH 6.2. I backup all the filesytems > with: > > /sbin/dump 0ubf 800 /dev/npt0 > > to a COLORADO 8gig. travan tape drive. Is this sort of backup regimen > a good one -- compatible with MySQL -- or should I instead be backing > up with FLUSH and (or) mysqldump? > > Any help would be greatly appreciated. > > > Richard > > > - > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> To > unsubscribe, e-mail > <[EMAIL PROTECTED]> Trouble > unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: Backup question
Howdy, I tend to do both a dump to disk and then stop the DB and do a tape backup. I don't believe there is an "Online" backup capability as user transactions would need to be stored and played back against the DB after the backup as in most production ready DB's. Sid Young QML Pathology Database Administrator > -Original Message- > From: Kraa de Simon [SMTP:[EMAIL PROTECTED]] > Sent: Monday, September 10, 2001 5:47 PM > To: '[EMAIL PROTECTED]' > Subject: Backup question > > Hi, > > I'm running MySQL on a NT box and do a nightly backup of the complete file > system to tape. > > I know I should use mysqldump and probably stop MySQL but will a file > system > copy do as well? The system is inactive at the time. > > Met vriendelijke groet / With kind regards, > > ICL Nederland B.V. Simon de Kraa > e-Applications / Logistic Systems Systems Architect > Het Kwadrant 1 Tel. +31 346 598865 > Postbus 4000Fax +31 346 562703 > 3600 KA MAARSSEN > The Netherlands mailto:[EMAIL PROTECTED] > > --- > > Progress 9.1b, Roundtable 9.1c, NuSphere Pro Advantage 2.2 @ MS Windows > 2000 > 5.00.2195 SP 2 > Progress 9.1b @ SCO UnixWare 7.1.1 > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: backup question
Look in the MySQL manual for mysqldump you should find the correct syntax On Mon, 15 Jan 2001, sanaa wrote: > hi > I want to know how to backup and restore databases in mysql. > > > thanks for help > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php