How to bring back my database to wamp sever?

不羁岁月 提交于 2019-12-08 08:37:28

问题


My server got crashed today morning, so before re-installing it I just copied the folder where my localhost was running so that my databases are not lost and trust me I preserved it safely. Now its re-installed and now my localhost is working but all I want is 'employee' database back to its place. How do I get it?

I copied the folder employee and saved back to where it was but its of no use. Am still stuck.

Reminding you, I didn't export it before re-installing. So can someone tell me how to face this situation?


回答1:


Ok so assuming you did do a complete backup of the old wampserver folders you can try this.

First make sure you stop all service via wampmanager

wampmanager -> Stop all Services

Now make a backup of this folder on the newly installed WAMPServer, so you can return to a vanilla, just installed state if this does not work.

move \wamp\bin\mysql\mysql5.6.17\data \wamp\bin\mysql\mysql5.6.17\data_vanilla

Now copy your backed up MySQL folder from the Previous installations files to the new install

copy \old_wamp\bin\mysql\mysql5.6.17\data \wamp\bin\mysql\mysql5.6.17\data

Now lets clear the mysql log file, so you dont get confused between old and new message in the log.

move \wamp\logs\mysql.log \wamp\logs\old.mysql.log

You should now be able to restart the MYSQL service and see if it starts up cleanly.

wampmanager -> MySQL -> Service -> Start/Resume Service

Now if the wampmanager icon goes Orange, MySQL should have started. Check the mysql error log, to see if all is well.

wampmanager -> MySQL -> MySQL log

If all is well, you can now start Apache as well.

wampmanager -> Apache -> Service -> Start/Resume Service

The wampmanager icon should go green.




回答2:


You need to import it back using phpmyadmin.

  1. open localhost/phpmyadmin
  2. select database then click import
  3. locate the database and click go

You probably can find the data that you back up earlier in here, \wamp\bin\mysql\mysqlXX\data




回答3:


when planning to recover, you should save the entire data directory . not just the folder with the database name .


refer the thread on superuser.

  1. go to data directory of mysql (C:\wamp\bin\mysql\mysql5.5.24\data )
  2. Find a file called "mysql-bin.index"
  3. Rename that file to "mysql-bin.index-corrupt"
  4. Restart the server and it will work fine, all your database will be where you left them.

or this thread on stackoverflow .

INNODB databases will have been stored in the
\wamp\bin\mysql\mysql5.6.17\ibdata1 file.

There will also be info in a \wamp\bin\mysql\mysql5.6.17\data\DATA_BASE_NAME\ folder, one .frm file for each table that was in the database, but this is basically just schema information and not actual data.

If you do not have that file from the old install then your data is lost. check this super user thread for further details .



来源:https://stackoverflow.com/questions/29743618/how-to-bring-back-my-database-to-wamp-sever

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