Data directory of mysql moving from one drive to different drive?
You can try with below steps.


Stop the existing MySQL instance using services.msc, shutdown must be clean so that the instance flushes any pending changes to disk.
After successful instance shutdown, copy the data directory from existing location to the new location.
Existing location: C:\ProgramData\MySQL\MySQL Server 5.7
New Location: E:\MySQL
Change datadir parameter in current my.ini file. I have commented old entry and added new one:
#datadir=C:/ProgramData/MySQL/MySQL Server 5.7\Data
datadir=E:\MySQL\Data
Start MySQL instance using services.msc
After starting MySQL successfully, you can verify above changes by creating temporary database and verify data directory for the same database.