欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Recovering MySQL DataBases on AWS instance after an unexpect_MySQL

程序员文章站 2022-05-23 17:49:47
...
Its possible that an AWS instance can run into various issues of unexpected crashes or can even be a case where you lost connectivity to your instance possibly due to network/firewall issue at AWS level or within your instance. In either of these cases, you’d have no choice than to re-configure your solution on a new instances. However, you will not have even an option to backup your MySQL DB that is running on the instance that is inaccessible.

If you have planned good and configured your WAMP solution in a way that MySQL DB Data files are relocated to a separate Volume. In which can you can recover your MySQl DB along with instance details by using below steps:

  • Shutdown the inaccessible instance and Detach it’s Storage volumes both the local system volume (attached as/dev/sda1) as well as external storage volume (attached as/xvdf-g).
  • Launch a new instance, attach the volumes you detach from the inaccessible instance in above step
  • In the new instance, install the MySQL with a default new instance and DB.
  • Use MySQL Workbench to connect to the newly installed DB and verify that MySQL is all running fine.
  • Then stop the MySQL DB instance from Workbench and exit from it.
  • Now rename the “C:/Program Files/MySQL/MySQL Server 5.1” to OLD
  • Copy over the “C:/Program Files/MySQL/MySQL Server 5.1” complete folder from the system volume that you attached.
  • Then rename “C:/ProgramData/MySQL/MySQL Server 5.1/data” to New
  • Ensure you attached the MySQL DB Data files volumes with the same label on the new instance. If not, you need to edit “C:/Program Files/MySQL/MySQL Server a5.1/my.ini” file and update the volume name
  • Now, Launch the Workbench and Start the MySQL server
  • If there are no issue with service start up, you’ll be all good to go with your MySQL DB running back with same data, users accounts and DB names