[Gllug] Re: Importing data into MySQL

Mark Preston mark at markpreston.co.uk
Mon Jul 26 05:09:32 UTC 2004


Hi all,
Thanks to *Liam Delahunty and */Tom Schutzer-Weissmann/
who replied to my question. I have changed
#!/bin/bash
# Back up toophpix data to Floppy disk.
mount /mnt/floppy
mysqldump --opt -u root databasename > /mnt/floppy/databasename.sql
umount /mnt/floppy

to
#!/bin/bash
# Back up toophpix data to Floppy disk.
mount /mnt/floppy
mysqldump -n -t -u root databasename > /mnt/floppy/databasename.sql
umount /mnt/floppy

and
#!/bin/bash
# Restore MySQL database details from floppy disk
mysql -u root databasename < /mnt/floppy/databasename.sql

to
#!/bin/bash
# Restore MySQL database details from floppy disk
mysql -f -u root databasename < /mnt/floppy/databasename.sql

This is along the lines suggested by Tom and the -f option means that 
the errors caused by duplicate patient details (which stop the other 
insert commands) are ignored, so that the other patient details (non 
duplicates) held on the floppy disk are inserted. Without the -f option 
the mysql command stops at the first error.
There may be other ways to do it, but this seems to be just what I need.
Thanks
Mark Preston


-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list