简体   繁体   中英

Recovering mysql database from data folder backup

I have uninstalled the old XAMPP and deleted all of the content of d:\xampp folder and installed the new one. When I copy my backup folder (with the name of my database, containing all .frm and .opt files) to the D:\xampp\mysql\data , the database shows in the list in phpmyadmin but it has no tables and data. What I've done wrong?

Here's how I dealt with this kind of situation:

  1. Stop the Apache and MySql services from xampp control panel.
  2. Back up (just in case), then delete the data folder from your new xampp installation folder <physical_drive>/xampp/mysql .

    (The data folder contains the schema/table definitions (.frm files) for your tables.)

  3. Copy the data folder from your previous xampp folder (or the backup) under mysql and paste it to the new location (ie <physical_drive>/xampp/mysql ).
  4. Now start the Apache and MySql services from the xampp control panel.

There you go, the tables should show up with their structures as you click on them.

Note : Make sure you leave the bin folder under your xampp installation folder untouched.

It is possible, I found out a solution:

  1. Install new xampp
  2. Copy your old database folder from xampp\mysql\data\databasefolder to Paste in your running xampp folder
    C:\xampp\mysql\data
  3. After that stop mysql and apache service then backup your running xampp files ib_logfile0,ib_logfile1 and ibdata1 and store in safe place
  4. Then Copy same file (ib_logfile0,ib_logfile1 and ibdata1) from old xampp\mysql\data\ and paste in your running xampp server C:\xampp\mysql\data\
  5. Start mysql and apache service Open CMD Fire command C:\xampp\mysql\bin>mysqldump -u dbusername -p dbpassword dbname>D:\exportdb.sql
  6. stop mysql and apache service and restore your main ib_logfile0,ib_logfile1 and ibdata1 file (check Step 3)
  7. after than again start service and open http://localhost/phpmyadmin/ and import database backup from D:\exportdb.sql Now your backup is working :)
  1. Copy your all old databases from old to newly installed Xampp under this dir

C:\xampp\mysql\data\

  1. Copy these below files from new xampp (C:\xampp\mysql\data) and keep back up

ib_logfile0, ib_logfile1 and ibdata1

  1. Similarly copy and replace ib_logfile0, ib_logfile1 and ibdata1 from old xampp to new xampp

  2. If previous Db has crushed or error like mysqld.exe has stopped working use below 2 lines inside my.ini file of mysql

    [mysqld]

innodb_force_recovery = 2

innodb_file_per_table=1

  1. Restart Apache and MYSQL and go to PHPMyadmin to export your previous database.
  2. finally replace your back up ib_logfile0, ib_logfile1 and ibdata1 that was taken bakup previously

在 xampp/mysql/bin/my.ini 中设置 datadir = "D:\xampp\mysql\data"

I ran into the same problem. I had all my projects in mysql which I lost somehow.

mysql under my old xampp had got deleted/uninstalled somehow. I did not even have the data folder to copy to new xampp location.

I browsed through the folders and found mysql/data and mysql/backup in below location.

C:\xampp\perl\mysql\data

C:\xampp\perl\mysql\backup

This is what I did.

I copied both these folders in place of new xampp mysql/data and mysql/backup folders.

I also copied other files (not folders) under /mysql from old xampp to new xampp /mysql.

Stop new xampp mysql and apache servers if running. Restart.

Viola I got all the lost databases back.

Hope this helps.

I have found a solution for this. I Installed new XAMPP and Replace old bin folder in Apache and mysql folders in old XAMPP with new folders from newly Installed Xampp I have recoverd all my data.

我刚刚从 xampp 文件夹结构中的 mysql 文件夹中复制了 data 文件夹,并将其粘贴到我新安装的相同结构中,现在一切正常。

I found this searching for the way to recover my XAMPP databases in Ubuntu. The question is obviously for a Windows system, but I think this might be of help since this was the only good search result.

For a standard installation in /opt/lampp/. You can recover the databases from the folder /opt/lampp/var/mysql/ if you have a backup of the whole lampp installation. (You might consider to add the mysql folder to your backup system, if you haven't.)

  1. Make sure, MySQL is not running.
  2. Copy the above folder to a new XAMPP installation.
  3. Make sure the owner is mysql.
  4. Start MySQL.

Your old databases should be accessible again.

I had similar problem which windows os is corrupted.

  1. Install new xampp, stop the services (apache, mysql)

  2. Copy this folder and files from old to new. location:

    C:\xampp\mysql\data ib_logfile0, ib_logfile1, ibdata1

  3. Start the services.

  4. Simply run phpmyadmin or run the site. It will work!

If you want to copy some database from old XAMPP to new XAMPP first of all, stop the Apache and MySQL from XAMPP control and follow these steps:

  1. go to the old_xampp/mysql/data
  2. copy ibdata1 file
  3. go to new_xampp/mysql/data
  4. paste the file that you are already copied (make replace)
  5. go to the old_xampp/mysql/data and copy the folder of database you want
  6. go to new_xampp/mysql/data paste the database folder
  7. restart apache and MySQL

Make sure install same version of mysql. It's really important. Copy the file ibdata1 and folders of data except mysql and perfomance_schema folders.

Had trouble with mine, thank you so much for this guide worked like voodoo charm. But mine I did upto step

Install new xampp

  1. Copy your old database folder from xampp\mysql\data\databasefolder to Paste in your running xampp folder C:\xampp\mysql\data

  2. After that stop mysql and apache service then backup your running xampp files ib_logfile0,ib_logfile1 and ibdata1 and store in safe place

  3. Then Copy same file (ib_logfile0,ib_logfile1 and ibdata1) from old xampp\mysql\data\ and paste in your running xampp server C:\xampp\mysql\data\

  4. open http://localhost/phpmyadmin/ and export database for futurebackup

My site is back and running without a hitch.

I've searched a lot. There's a few other files that are needed for recovery. I think it's impossible to recover tables from the .frm files alone. I've re-created my database.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM