Bug #65022 changing datadir on windows
Submitted: 18 Apr 2012 12:06 Modified: 7 Jun 2012 0:15
Reporter: Olivier Olivier Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.5 OS:Windows (x64)
Assigned to: Philip Olson CPU Architecture:Any

[18 Apr 2012 12:06] Olivier Olivier
Description:
Hi,

I tried to change datadir on a Windows 7 x64 machine with 5.5 I placed my.ini 
inside %windir% that's to say c:\windows\my.ini, as explained there
http://dev.mysql.com/doc/refman//5.5/en/windows-troubleshooting.html

but it doesn't work.

Olivier

How to repeat:
change datadir on a Windows 7 x64 machine with 5.5 I placed my.ini 
inside %windir% that's to say c:\windows\my.ini, as explained there
http://dev.mysql.com/doc/refman//5.5/en/windows-troubleshooting.html
[18 Apr 2012 12:18] Valeriy Kravchuk
Can you, please, give more details on what exactly does not work? Server do not read %windiw%\my.ini? 

Please, specify the exact version used, 5.5.x, and other installation details. Do you start MySQL as Windows service?
[18 Apr 2012 12:31] Olivier Olivier
5.5.23
Yes,windows as a service. I stopped it and restarted it after each modification
I create a my.ini with
[mysqld]
datadir=c:/my_data_folder

I tried to put my.ini in c:\windows, or copy mysql\mysql server 5.5\my-medium.ini to my.ini, adding datadir do [mysqld] section with no result. When I try show variables like 'datadir', it's still set to c:\programdata...
[18 Apr 2012 13:13] Valeriy Kravchuk
Check parameters of Windows service in the registry (in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MySQL55 or whatever service name do you use). Service probably still refers to old location of my.ini (if you had NOT re-created it explicitly). 

ImagePath there in my case has the following value:

"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --defaults-file="C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.5\my.ini" MySQL55

You can just edit it, or re-create service as our manual describes.
[18 Apr 2012 13:27] Olivier Olivier
Yes, I foud at the same time that it was using C:\programData\Mysql\Mysql Server 5.5\my.ini which does'nt appear by default with windows.

Problem is that when I change the datadir folder in this file, service can't start, I get a 1067 error mysql.host doesn't exists.
[18 Apr 2012 13:40] Valeriy Kravchuk
That manual page you mentioned initially explains that one should copy content of existing datadir into a new datadir when changing it. Please, check.
[18 Apr 2012 13:52] Olivier Olivier
Yes you're right, so it's ok now. thanks for your help.

I suggest that the documentation explains this default location (Programdata) which is a bit difficult to guess as it's hidden by default. I added a comment to the page.

http://dev.mysql.com/doc/refman/5.5/en/windows-troubleshooting.html
[18 Apr 2012 14:10] Valeriy Kravchuk
I agree that we have a valid documentation request here.
[7 Jun 2012 0:15] Philip Olson
This has been fixed in SVN. The 5.1 documentation already contained this information, so this is now synced with the 5.5/5.6 documentation. 

Thank you for the bug report.