MySQL : Step by step changing the datadir in MySQL on windows

Опубликовано: 30 Сентябрь 2024
на канале: E-MultiSkills Database services
262
3

MySQL :How to Change MySQL Data Directory to a New Location on windows




Step 1 — Checking current MySQL Data Directory

mysql -u root -p
mysql1234

MYSQL# select @@datadir;
C:\ProgramData\MySQL\MySQL Server 5.6\Data\



Step 2 — ShutDown mysql services

search for # services.msc
locate MYSQL56 and stop it

Step 3 - Move files from old directory to new dir


C:\ProgramData\MySQL\MySQL Server 5.6\Data_1\

C:\ProgramData\MySQL\MySQL Server 5.6\Data_2\

Step 4 - Edit my.ini to point to new datadir location



edit my.ini

replace C:\ProgramData\MySQL\MySQL Server 5.6\Data_1\ with C:\ProgramData\MySQL\MySQL Server 5.6\Data_2\

and save exit

step 5 - Start mysql service and verify the new configuration

search for # services.msc
locate MYSQL56 and start it


mysql -u root -p
mysql1234

select @@datadir;