Bug #34593 not READONLY files should be in 'AppData' folder
Submitted: 15 Feb 2008 12:40 Modified: 16 May 2008 14:40
Reporter: Peter Laursen (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:any OS:Microsoft Windows (most important for Vista)
Assigned to: Iggy Galarza CPU Architecture:Any
Tags: qc
Triage: D2 (Serious)

[15 Feb 2008 12:40] Peter Laursen
Description:
On Windows Vista a non-admin user does not have write access to the "\Program Files\.." (or whatever localized name it has) folder tree if 'User Account Control' is turned ON (applies to 32 bit programs only I think).  Files will be created in a user-dependent 'virtualized' folder instead. 

Microsoft recommends such not READONLY files) to go to 'AppData' (folder name may be localized).  This applies to the default /datadir setting as well as log files etc.

In corporate environments it occurs that practically no user has admin privileges.

How to repeat:
se above

Suggested fix:
For instance on English localisations 
"{system drive}\Program Data\MySQL\MySQL Server x.y" would be appropriate on Vista.
[19 Feb 2008 22:45] Peter Laursen
btw: I would guess that this applies to Windows Server 2008 as well (now in RC, final release planned for March 2008 I believe)
[24 Feb 2008 13:35] Peter Laursen
AT LEAST the configuration wizard should handle this!
[14 Mar 2008 19:46] Patrick Crews
Ok to push.

Verified changes work as documented by developer.

Also worked to add significant warnings for upgrading users that the default data location has changed and that they will need to address this if they wish to use data from an existing 5.1 installation.  Corrective steps are listed for the user to apply in such a situation.

Tested on both XP and Vista.
[16 May 2008 14:40] MC Brown
A note has been added to the 5.1.24 and 6.0.5 changelogs:

Important Change: Security Enhancement: On Windows Vista and Windows Server 2008, a user without administrative privileges does not have write permissions to the Program Files directory where MySQL and the associated data files are normally installed. Using data files located in the standard Program Files installation directory could therefore cause MySQL to fail, or lead to potential security issues in an installed instance.

To address the problem, on Windows XP, Windows Vista and Windows Server 2008, the datafiles and data file configuration are now set to the Microsoft recommended AppData folder. The AppData folder is typically located within the user's home directory.

Important

When upgrading an existing 5.1.23 or 6.0.4 installation of MySQL you must take a backup of your data and configuration file (my.ini before installing the new version. To migrate your data, either extract the data and re-import (using mysqldump, then upgrade and re-import using mysql), or backup your data, upgrade to the new version, and copy your existing data files from your old datadir directory to the new directory located within AppData.

Failure to backup your data and follow these procedures may lead to data loss.