How to Restoring MySQL database from physical files

十年热恋 提交于 2019-12-11 05:24:47

问题


Unfortunately I uninstalled Xampp in my windows machine, there are about 50 databases in /xamp/mysql/data folder. I have not taken backup script, but I have a copy of Xamp/mysql/data folder.How can I restore MySQL Databases using that Data Directory.

Thanks in Advance


回答1:


I was find out 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 :)



回答2:


Install the same Server version again, Stop it , copy the datadir and Start the servrr




回答3:


I experienced with my Mac, before selling to a friend simply copy the XAMPP folder only to my hard drive. (NOT SUCCESS) Unfortunately, it was bringing trouble to me, because I tried the following steps: - I install fresh XAMPP and copy the whole \httdocs and var\mysql to my new Mac, those db only with .frm and .ibd, NOT WORKING, I can't still access the tables inside PHPMyAdmin ... - I tried to install the same xampp version and repeat the above steps, still NOT WORKING. - Decided to go to bed.

(SUCCESS) - This morning, I brought my backup disk and try with Windows 7. - Install fresh latest XAMPP for Windows, c:\xampp - I have one of website (folder) from my backup \httdocs and correspond database folder inside \var\mysql are READY in my windows 7, I just want to try with one website then try the rest because I have many projects inside httdocs\ and \var\mysql - I copy the mention httdocs\ folder to windows c:\xampp\httdocs and copy the \var\mysql to c:\xampp\mysql\data

NOT LAST YET I copy the ib_logfile0, ib_logfile1, ibdata1 from my backup file to windows xampp c:\xampp\mysql\data

I refresh the http://localhost/mywebsite

WOW WOW DONE ... it's working...



来源:https://stackoverflow.com/questions/42944259/how-to-restoring-mysql-database-from-physical-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!