search

Home  >  Q&A  >  body text

How to add existing schema to mysql on windows

I haven't seen anything about this topic anywhere, not even here.

The problem is that I have a MySQL 8.0 database that is on a previous hard disk (HD). Boot failed on the original drive so I copied the folder

C:\ProgramData\mysql\MySQL Server 8.0\Data\my_db
moved to the new HD and reinstalled MySQL.

My problem is that I don't see a way to install this architecture. Does anyone have any suggestions?

P粉204136428P粉204136428470 days ago621

reply all(1)I'll reply

  • P粉099000044

    P粉0990000442023-09-15 12:15:50

    You cannot see your data because information about existing objects is stored in a system database that is not replicated.

    If your previous hard drive is unavailable:

    1. Ensure that the MySQL versions on the old and new operating system instances are exactly the same. If not, remove MySQL on the new operating system and reinstall the required version.
    2. Stop the MySQL service.
    3. Rename the data folder (C:\ProgramData\MySQL\MySQL Server 8.0 => C:\ProgramData\MySQL\MySQL Server 8.0.bak).
    4. Completely copy the data folder from the old hard drive to the new hard drive.
    5. Start the MySQL service.
    6. Need to back up the old database.
    7. Stop the MySQL service, delete the data folder copied from the old hard disk, and rename the saved data folder back.
    8. Start the MySQL service.
    9. Restore the database.
    10. If you reinstalled MySQL in step 1, you can upgrade the MySQL version to the required version through the regular way.

    reply
    0
  • Cancelreply