Step 1:
Stop the existing MySQL instance using services.msc, shutdown must be clean so that the instance flushes any pending changes to disk.
Step 2:
After successful instance shutdown, copy the data directory from existing location to the new location, in my case:
Existing location: C:\ProgramData\MySQL\MySQL Server 5.7
New Location: E:\MySQL
Step 3:
Change datadir parameter in current my.ini file. I have commented old entry and added new one:
# Path to the database root #datadir=C:/ProgramData/MySQL/MySQL Server 5.7\Data datadir=E:\MySQL\Data
Step 4:
Start MySQL instance using services.msc
Step 5:
After starting MySQL successfully, you can verify above changes by creating demo database and verify data dirctory for the same database. Test database: Myslott
Database Created successfully and myslott directory also created under new data directory.
Cheers!!
Stay Tune. 🙂
I have moved my MySQL directory to a new location (D) but my disk space on C is reducing (from 270GB to 244GB) after i added some table to my DB.
How do i fix this?
it seems that if you follow the above way, and finally when you start the mysql service, it still uses the previous my.ini file not the new my.ini which only copied in different location
still generates error Some services stopped automatically. However I set Network SERVICE permission to new drive
the most important think you didnt wrote which is DONT CREATE THAT FOLDER BEFOREHAND