Applicable to:
- Plesk 17.8 for Windows
- Plesk Obsidian for Windows
- Plesk Onyx 17.8 for Windows
Question
How to change default MySQL folder to another one?
Answer
Note: Custom data directory location for client's MySQL has been supported since Plesk 17.8 MU #41
To change database location follow next steps:
-
Shut down MySQL service through Control Panel > Administrative Tools > Services > right-click MySQL57 > Stop.
Note: if MysQL 5.6 is used, stop
MySQL Server
service instead. -
Copy
"%plesk_dir%"\Databases\MySQL\data
to the new location (e.g. D:\MySQL\data). -
Edit "datadir" option in the
C:\"%plesk_dir%"\Plesk\Databases\MySQL\my.ini
file in the following way:CONFIG_TEXT: [MySQLD]
port=3306
...
datadir=D:\\MySQL\\Data
... -
Give "Full control" permission to the "NT SERVICE\MySQL57" group: right-click the destination folder > Properties > Security.
Note: if MysQL 5.6 is used, Give "Full control" permission to the "NT SERVICE\MySQL56" group instead.
-
Start "MySQL57" service Control Panel > Administrative Tools > Services > right-click MySQL57 > Start.
-
To prevent "Plesk Reconfigurator" to change the path to the new folder location edit the
C:\%plesk_dir%\etc\DiskSecurity.xml
file in the following way:CONFIG_TEXT: <!-- [PRODUCT_ROOT_D]\MySQL\bin -->
...
<Entry AccounType="1" Domain="NT SERVICE" Account="MySQL57" Path="<D:\MySQL\Data>" AceFlags="FilesOnly" AccessMask="ReadAndExecute" EntryFlags="0x04" />
...Note: D:\MySQL\Data is the path to the new folder location and can be changed to any required one.
- To prevent the resetting of
datadir
value it is required to change the path in theMYSQL_DATA_D
registry to the required one:
1. Click the Start button.
2. Typeregedit.exe
and press the Enter button: 3. In the opened Windows registry navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\PLESK\PSA Config\Config and find theMYSQL_DATA_D
string which contains the actual database directory:
Comments
2 comments
What are the equal instructions for moving any existing MYSQL DB and create a new default MYSQL database directory on Plesk Onyx/Ubuntu?
@Christian
Changing the location for a MySQL server is not officially supported by Plesk since it can cause a lot of different issues with websites and overall Plesk performance.
As an alternative to moving the MySQL data directory to another location, consider mounting a partition from a new disk to the default MySQL data directory location /var/lib/mysql/.
Please sign in to leave a comment.