[Mailman-Users] URGENT HELP! I just screwed a clients database!

Jerry Feldman gaf at blu.org
Sat Apr 19 17:37:09 CEST 2003


On 19 Apr 2003 15:36:56 +0000
Angel Gabriel <badmangabriel at lycos.co.uk> wrote:

> I don't know WHAT I did, or even if I did it, but a clients database
> is screwed. There is no backups avavlible, the backup guy is on
> holiday, and this is a BIG office
> 
> Bascially, I copied all the data from MySQL on one machine, and put it
> on another, but for some reason, all the data is in ONE record. I'm no
> database expert, but I know that's bad. After consulting with the
> owners of the database, I find this is not the first time it's
> happend, there is an error in one of thier copy scripts, and they
> forgot to tell me. But what I need to do is EXTRACT all the data into
> seperate files.
> 
> This is not easy to automate, because not all the records have the
> same number of fields, and not all fields are even used. The unique
> key for each record is the email address. How would I grep for email
> address, and then strip out the ENTIRE record? The data is structured
> in such a way that it goes, email address - data - email address. The
> data could be phone number, contact name, postal address, fax machine,
> or a combination of the above.
I don't know why this is on a mailman list but...
1. Use the mysqldump utility to dump the database. This produces all the
appropriate commends to load a new database.
   ex: mysqldump -h myhost -u <user> -p<mypassword> dbname >
dbname.bak.sql

2. create the new database:
	ex. mysqladmin -h myhost -u <user> -p<mypassword> create dbname

3. Restore from your backup:
mysql -h myhost -u <user> -p<mypassword> dbname < dbname.bak.sql

That should restore everything properly into the new database. 


-- 
Jerry Feldman <gaf at blu.org>
Boston Linux and Unix user group
http://www.blu.org PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9




More information about the Mailman-Users mailing list