Bug #99946 Changing data folder crashes mysql service
Submitted: 21 Jun 2020 14:53 Modified: 22 Jun 2020 12:44
Reporter: NoneOf YourBusiness Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:8.0.19.0 OS:Windows
Assigned to: MySQL Verification Team CPU Architecture:Other (x64)

[21 Jun 2020 14:53] NoneOf YourBusiness
Description:
After completing crappy setup configuration that insists seting up my data folder in drive C without asking me, managed to configure data folder to use another drive.

If I try starting the mysql service it fails with error 

[InnoDB] Plugin initialization aborted with error Generic error.
[Server] Failed to initialize DD Storage Engine
[Server] Data Dictionary initialization failed.
[Server] Aborting

If I copy the files from folder in drive C, to my current data folder it starts working again.

Now I have a complete folder structure from previous installation of same version of MySql with lots of databases. If I replace current data folder with my existing, service will crash again with same error as above.

I would like to know with your current configuration how to restore databases after OS drive is wiped and renewed and mysql is installed again.

How to repeat:
To reproduce issue 1:

backup content of the data folder and delete its content.
try starting service

To reproduce issue 2:
copy data folder from another server (simulating wiped OS drive) to current server and try starting service.

Suggested fix:
Restoring databases from a server to another is a common thing and happens for so many reasons such as

 - A damaged OS HDD which need to be replaced. 
 - Migrating data to new server due to space requirement 
 - Migrating data to server due to hardware upgrade.

Migrating databases from a server to another is a simple matter of copying database files from one server to another and in some cases with running an extra command in sql console. I'm not sure why such a trivial task even in Microsoft SQL Server, should be such a painful process in MySql server.
[22 Jun 2020 11:53] MySQL Verification Team
Thank you for the bug report. Have you edited my.ini for the new data directory (you had not mention that)?

https://dev.mysql.com/doc/refman/8.0/en/multiple-data-directories.html
[22 Jun 2020 12:34] MySQL Verification Team
Hi,

Just tested on Windows 10, moving datadir to d: e: g: .. no problem

kind regards
Bogdan