Re: Repairing/Restoring a Database

2005-05-25 Thread SGreen
matt g [EMAIL PROTECTED] wrote on 05/25/2005 12:45:22 PM:

 While updating a record in a database, I inadvertantly forgot a
 where statement; so instead of changing just one record, I changed
 all 900 records in the database.
 
 I've been trying to figure out how to fix this.  My latest backup
 (through mysqldump) was about fifteen days ago.  I'm fine with
 restoring the database to that point, and updating the rest by hand,
 but I'm having problems doing so.
 
 Some tutorials that I've read (such as this one
 http://www.devshed.com/c/a/MySQL/Backing-up-and-restoring-your-
 MySQL-Database/2/
 ) say that I should do the following:
 ___
 
 /usr/local/mysql/bin/mysql -u [username] -p [password]
 [database_to_restore]  [backupfile]
 ___
 
 But when I execute that command from the shell (starting from the
 directory in which the backup exists), I get a long message like this:
 
 /usr/local/mysql/bin/mysql  Ver 12.22 Distrib 4.0.21, for pc-linux 
(i686)
 Copyright (C) 2002 MySQL AB
 This software comes with ABSOLUTELY NO WARRANTY. This is free software,
 and you are welcome to modify and redistribute it under the GPL license
 Usage: /usr/local/mysql/bin/mysql [OPTIONS] [database]
   -?, --help  Display this help and exit.
   --auto-rehash   Enable automatic rehashing. One doesn't need to 
use
   'rehash' to get table and field completion, but 
startup
   and reconnecting may take a longer time. Disable 
with
   --disable-auto-rehash.
 
 etc. etc.
 
 
 What am I doing wrong?  And is there an easier way to do this?
 
 Thanks in advance for your help!
 

You can try doing the same steps, but break it down so that you do them 
one at a time.

FIRST: open the MySQL CLI and attach to the server hosting the database 
you want to restore:

(in a command shell) mysql -h [name or IP address of server] -u [your 
mysql account] -p

Respond with your password when you are prompted. You should now be inside 
a MySQL client session. SECOND: make your destination database the active 
database for your session:

USE [database name];

Third: process your MySQL dump file:

source [fully-qualified path to dump file];

This is the slower, manual way of doing what your command line did all at 
once. One other idea, on Win32 machines there can be NO SPACE between the 
-p and the actual password (should you opt to put it in the command). You 
might try reformatting your command to remove that space.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Re: Repairing/Restoring a Database

2005-05-25 Thread matt g
One more note for anyone else who runs into this problem:  before
running the source command, I dropped the database, recreated it, and
then ran the mysqldump file into the empty database.

Matt



 On 5/25/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 
  You can try doing the same steps, but break it down so that you do them one
  at a time.
 
  FIRST: open the MySQL CLI and attach to the server hosting the database you
  want to restore:
 
  (in a command shell) mysql -h [name or IP address of server] -u [your mysql
  account] -p
 
  Respond with your password when you are prompted. You should now be inside a
  MySQL client session. SECOND: make your destination database the active
  database for your session:
 
  USE [database name];
 
  Third: process your MySQL dump file:
 
  source [fully-qualified path to dump file];
 
  This is the slower, manual way of doing what your command line did all at
  once. One other idea, on Win32 machines there can be NO SPACE between the -p
  and the actual password (should you opt to put it in the command). You might
  try reformatting your command to remove that space.
 
  Shawn Green
   Database Administrator
   Unimin Corporation - Spruce Pine


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



Re: Repairing/Restoring a Database

2005-05-25 Thread matt g
Thank you *SO* much, Shawn.  Doing it manually did the trick.  

I'm sure you know how frustrating this can be.  I really, really
appreciate your help.  Whew!

best,

Matt


On 5/25/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 You can try doing the same steps, but break it down so that you do them one
 at a time. 
  
 FIRST: open the MySQL CLI and attach to the server hosting the database you
 want to restore: 
  
 (in a command shell) mysql -h [name or IP address of server] -u [your mysql
 account] -p 
  
 Respond with your password when you are prompted. You should now be inside a
 MySQL client session. SECOND: make your destination database the active
 database for your session: 
  
 USE [database name]; 
  
 Third: process your MySQL dump file: 
  
 source [fully-qualified path to dump file]; 
  
 This is the slower, manual way of doing what your command line did all at
 once. One other idea, on Win32 machines there can be NO SPACE between the -p
 and the actual password (should you opt to put it in the command). You might
 try reformatting your command to remove that space. 
  
 Shawn Green
  Database Administrator
  Unimin Corporation - Spruce Pine

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