Bug #37534 InstanceConfig does not pick up current datadir
Submitted: 19 Jun 2008 23:30 Modified: 17 Aug 2009 19:05
Reporter: Peter Brawley (Basic Quality Contributor)
Status: Closed
Category:Server: Installing Severity:S3 (Non-critical)
Version:5.1.25-rc OS:Microsoft Windows (W2K SP4)
Assigned to: Iggy Galarza Target Version:6.0-beta
Tags: instanceconfig, qc
Triage: Triaged: D3 (Medium)

[19 Jun 2008 23:30] Peter Brawley
Description:
InstanceConfig.exe ignored the current (5.1.24-rc) datadir setting, instead setting a new
datadir in the program files tree.

Nor did it offer a user choice for where to put or find datadir.

There are three things wrong with that. 

1. User should be offered a choice (!).

2. It's bad practice to store user data with program files.

3. InstanceConfig ought to have picked up the current datadir. It's not hard--all it has
to do is find the active my.ini using MySQL's well documented rules for where that file
is. 

How to repeat:
Run instanceconfig.exe on an existing MySQL installation where datadir is not in the
default locaiton.

Suggested fix:
Correct instanceconfig to find the current datadir, offer the user a choice, and change
the default from the program files tree.
[20 Jun 2008 15:15] Susanne Ebrecht
Many thanks for writing a bug report.

Please let us know:

1) how did you install MySQL?
2) how did you start the daemon?
3) did you restart the daemon after changing data dir?
4) did you make mysql_install_db again after changing data dir?
[20 Jun 2008 18:42] Peter Brawley
"How did you install Mysql?" 
Ran setup.exe from the archive

"How did you start the daemon?" 
Checked the InstanceConfig option to start the service. It did so.

"Did you restart the daemon after changing data dir?" 
Eh? Stopped the service before running setup.exe. InstanceConfig started the service when
it completed its activities. Running a client at that point made it clear that
InstanceConfig had ignored the 5.1.24-rc datadir, so I stopped the service, edited
my.ini, then restarted the service.

"Did you make mysql_install_db again after changing data dir?"
How could I make mysql_install_db? I do not understand the question.
[20 Jun 2008 19:10] Sveta Smirnova
Thank you for the report.

Verified as described. About datadir location see also bug #37542.
[1 Dec 2008 23:34] Iggy Galarza
Proposed patch

Attachment: bug37534.patch (application/octet-stream, text), 4.15 KiB.

[17 Dec 2008 22:26] Patrick Crews
Ok to push.

I think we might want to be detailed about this in the docs:

If you have a custom installation and seek to upgrade 5.1.29->5.1.30 for example, you
*must* select custom installation and re-specify the custom settings otherwise the
defaults will be used.

If your datadir changes, the Instance Config will alert you. (something like that).
[17 Aug 2009 18:42] MC Brown
A note has been added to the 5.1.32, 5.4.40, 6.0.10, 4.1.26 changelog: 

Important Change: When using the MySQL Instance Configuration Wizard with a configuration
where you already have an existing installation with a custom datadir, the wizard could
reset the data to the default data directory. When performing an upgrade installation in
this situation, you must re-specify your custom settings, including the datadir, to
ensure that your configuration file is not reset to the default values.
[17 Aug 2009 19:05] Peter Brawley
The documentation change is an improvement, but the three InstanceConfig.Exe issues
described in the original bug report remain:

1. InstanceConfig ought to pick up the current datadir.

2. The user should be offered an explicit choice to keep or change the current datadir.

2. It is bad practice to store user data with program files.