1

I have a dead hard drive. I've connected it with SATA to USB IDE and can recover files. Also the filesystems looks good. How Can I get a dump of database from that hard drive. The laptop I'm using also has mysql installed in it. I'm using xampp. I've tried the following command.

G:/xampp/mysql/bin/mysqldump -u root -p uma > D:/umaoldbackup.sql

This is not giving dump of a latest data. And I think it's giving dump from my local computer.

Please help.

Alias
  • 681
  • 16
  • 55

1 Answers1

2

Correct, mysqldump connects to the running MySQL Server process on your local computer, not the data on your sick hard drive.

MySQL client applications like mysqldump do not read the data files directly. They connect to a MySQL Server process and make requests for the data. Before you can access that data, you need to restore the data files to the data directory of an instance of MySQL Server.

  1. Stop the MySQL service.
  2. Copy data files to the data directory of your MySQL service. Move any existing data files to someplace else that is safe, if you want to bring back that data after exporting your umaoldbackup.
  3. Start the MySQL service so it can read the files in that data directory.

You should probably get someone to do this for you if you don't know how to start and stop services on Windows.


Re your comment about where is the data directory...

I'm not a user of Windows or XAMPP.

It's probably actually C:\xampp\mysql\data according to What is the exact location of Mysql database tables in XAMPP folder?

But you can confirm that by connecting to your current MySQL service with a client and running the following query:

SELECT @@datadir;
Community
  • 1
  • 1
Bill Karwin
  • 538,548
  • 86
  • 673
  • 828