Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to restart mysql after changing the datadir

I am unable to restart the server after changing the default datadir from C:/ProgramData/MySQL/MySQL Server 5.7\Data to D:/Data.

  • I changed datadir to datadir="D:/Data"
  • Then I stopped mysql
  • Copied the Data directory to D:/
  • Attempted to restart the server
  • Unable to start

What could be the reason for it?

Error snapshot:

enter image description here

However, it works fine if the original datadir path is restored.

like image 654
Suhail Gupta Avatar asked Jan 19 '16 14:01

Suhail Gupta


People also ask

How do I restart MySQL?

First, open the Run window by using the Windows+R keyboard. Second, type services. msc and press Enter : Third, select the MySQL service and click the restart button.


2 Answers

Assign full permissions to the NETWORK SERVICE for D:/Data

like image 96
sski Avatar answered Nov 17 '22 01:11

sski


Ensure my.ini is ANSI encoded with a tool like Notepad++.

I updated the datadir in my.ini with Windows Notepad and it apparently converted it to UTF-8; I copied the file over to a system with Notepad++, converted it back to ANSI before copying it back to the MySQL server and was able to start the MySQL service successfully.

like image 25
webthaumaturge Avatar answered Nov 17 '22 00:11

webthaumaturge