patternsqlModerate
Changing Data Directory on MySQL DB Server
Viewed 0 times
directorymysqlserverchangingdata
Problem
I have installed mysql server 5.6.24 on Windows Server 2012 R2.
I imported dump files and the data files are stored in
I want to change directory like
Can you please help me, anyone ?
I imported dump files and the data files are stored in
C:\ProgramData\MySQL\MySQL Server 5.6\dataI want to change directory like
D:\ProgramData\Data. Can you please help me, anyone ?
Solution
-
Open Windows CLI as Administrator and Shutdown MySQL
-
Copy the Data to
-
Create or edit
Add this to the
-
Startup MySQL
If you can not execute
-
Login to MySQL and verify everything is good
When you login to MySQL, run this
Remember to give your new data directory the same full permissions for users Network Service and Administrator that the default data dir was using, otherwise it'll cause the dreaded "started and then stopped" error. Don't delete this dir until you're sure your new one is working.
If this does not work, here is the rollback plan:
Open Windows CLI as Administrator and Shutdown MySQL
net stop mysql
-
Copy the Data to
D:\ProgramData\Dataxcopy /s C:\ProgramData\MySQL\MySQL Server 5.6\data D:\ProgramData\Data
-
Create or edit
C:\ProgramData\MySQL\MySQL Server 5.6\my.iniAdd this to the
my.ini[mysqld]
datadir = D:/ProgramData/Data
-
Startup MySQL
net start mysql
If you can not execute
net start mysql, try the Windows control panel.-
Login to MySQL and verify everything is good
When you login to MySQL, run this
mysql> SHOW GLOBAL VARIABLES LIKE 'datadir';
Remember to give your new data directory the same full permissions for users Network Service and Administrator that the default data dir was using, otherwise it'll cause the dreaded "started and then stopped" error. Don't delete this dir until you're sure your new one is working.
If this does not work, here is the rollback plan:
net stop mysql
del "C:\ProgramData\MySQL\MySQL Server 5.6\my.ini"
net start mysql
Context
StackExchange Database Administrators Q#111829, answer score: 10
Revisions (0)
No revisions yet.