Loading my previous database into a new installation of MySQL
Some time ago, I was working through the SQL course. I had some technical issues with my laptop that required installing a new hard drive and operating system. I copied the data and files, that I could identify, from my previous system onto another medium to transfer later.
Today I decided to finally tackle the tasks of reinstalling MySQL on my new system. I did this successfully. Now, I would like to load my previous database so I will not have to start the course from the beginning. The problem is that I really dont know where the database was stored, i.e. where I should look for it in the files I copied.
In my original PROGRAM FILES folder, I have a MYSQL folder. Inside that folder are folders for MYSQL SERVER and MYSQL WORKBENCH. I am not sure in which of these the database is stored. Can you assist?
Thank you!
UPDATE: In the meantime, I did some "research" and found the folders containing the original database on my old hard drive. I tried to replace the new DATA folder with the original one. I cannot seem to log into it. I am sure the password is 365Pass as suggested in the lesson video... Is there any way that that I can access these database files through my new install of MySQL Server and Workbench?
Error when I substitute the folders and try to log into the original database...
Hi Mike!
Thanks for reaching out!
You can try the following steps:
Close MySQL workbench, find the MySQL Setup installation file (or download it once again), and run it.
From the MySQL Installer remove MySQL Server and click Next until the process is finished.
Then click Add and from the menu choose the latest MySQL Servers version and click the right arrow. Continue with the installation by choosing Next and Execute. After the operation is finished, close the Installer and run MySQL Workbench. Then, try connecting to the server again.
Hope this helps.
Best,
Ivan
Hi, Ivan,
Thank you for the suggestion. Unfortunately, that did not solve my issue.
I uninstalled and reinstalled the 8.0 Server several times, substituting the data folder both before and after the installs to see if I could access the original database with my coursework in it. I even tried installing the 5.7 version of the Server, which I think was the one I was using initially. My password is still not accepted when I try to make a connection to the database with my work in it. The new data folder that is created with the install does allow Workbench to open with the password and no issues.
How would I technically migrate the database in normal scenario, since it is becoming obvious to me that I won't be able to just substitute the data folder by copying it? Perhaps that will allow me to access the data I have been practicing with without having to start from scratch.
Kind regards,
Mike
Hi Mike!
You can try the following steps:
- open MySQL Workbench and create a connection for the old server
- create a connection for the new server
- in the Administration window go to Management and then after choosing the old server, select all schemas in the Data Export tab and click Export
- go to the Data Import/Restore tab from the Administration window selecting the new server
- choose "import from Self-contained File" and perform Import
Hope this helps.
Best,
Ivan
Ivan, How do I create a connection to the OLD server? That seem to be the issue. I cannot seem to navigate to the folder from Workbench in a way I understand. The only place I see that I can specify it requires a Hostname and a Port. Where do I find those pieces of information? I know where the folder are, but I cannot figure out how to navigate to them in order to create a connection. Below is the screenshot of what my guess is, are the coordinates for the NEW local instance. *SIGH*
Hi Mike!
Which version of MySQL Workbench are you currently using? Can you please try this time to install version 8.0.11 and try the migration process once again in order to fix the Operation failed error? If an error message appears, you can try to add the value "C:\Windows\System32" to the path environment variable:
In the search bar type: Environment and choose Edit the system environment variables > Environment variables > System variables.
The authentification method is different in the newer versions.
You should be able to navigate with the older version but please feel free to post another screenshot if it doesn't work.
You can also try navigating by opening the MySQL Workbench >> Database >> Schema Transfer Wizard
Hope this helps.
Best,
Ivan