0

I have a system that I developed in Java Spring and that stores data on a MySQL database run locally on windows 10.

Yesterday, I ran the latest windows update, and after 2 hours of grinding my computer crashed... and since then, windows does not want to start, and gives me the option to reinstall windows, with the possibility to keep my personal data. However, I think that it will erase MySQL and all the data that is stored.

I have linux running on the same machine, and so I am trying to use Linux to access the database in order to back it up using mysqldump.

In order to do that, I have tried to mount the directory where the data is saved on windows to the linux directory using the following command:

sudo mount --bind '/media/guillaume/Windows/ProgramData/MySQL/MySQL Server 5.7/Data' /var/lib/mysql

I then restarted the mysql server and I opened an SQL console. I could log in to the SQL Console using the Windows password (it is different from the SQL password on Linux), and I could list all the databases saved on my windows machine.

This when it gets more complicated. The SQL console can list all tables in the database that I am interested in, but for some reason, it cannot query the content of the tables. I can list all tables, but I cannot query the tables. SQL tells me that such a table does not exist, even though it has just listed it.

I have a screenshot of this, there is no typo, but the site does not let me post an image...

How can I resolve this issue? Or is there a smarter way to create a dump from the windows location, even though windows is not starting?

Thank you for your help !

0
1

The reason that it did not work is that I had renamed the database in windows as "database_W", in order to differentiate it from the other database in linux that had the same name and that I had recovered from a back up that I did 2 weeks ago.

I had copied the windows ProgramData file to an external disk, so I copied that back up of the database into my target folder, and then the SQL console as well as my IDE could see this original database, all its tables and all the data. I used my IDE to create a backup file (dump).

As Rinzwind pointed out, it is critical to back up the data regularly, especially before windows updates... lesson taken!

So what I did to recover the data was:

  1. Use linux to access the windows data, and back up all your data
  2. To recover SQL data, you are interested in the following location: '/media/guillaume/Windows/ProgramData/MySQL/MySQL Server 5.7/Data'. DO NOT CHANGE ANY NAME IN THERE!
  3. Use the following command to mount your windows ProgramData file to the appropriate linux directory: sudo mount --bind '/media/guillaume/Windows/ProgramData/MySQL/MySQL Server 5.7/Data' /var/lib/mysql
  4. Restart your sql service (I used this command: service mysql restart)
  5. Check with your SQL console in the Linux terminal that you can see the windows databases from Linux and that you can access the data (using a select * from table type of statement);
  6. Use your IDE to connect to this database (using the windows credentials) in order to create a dump file from the IDE.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.