Jump to content
The Uniform Server Community

MySQL data directory


paul_norman_81
 Share

Recommended Posts

Hi,

 

I've just updated my local development copy of Uniform Server from an outdated Coral release to the new Zero XI 11.1.7 and am enjoying the more modular layout. I've had no trouble getting PHP (5.3 -> 5.6) and Apache configured for my needs, but I don't seem to be able to swap the MySQL data directory on either 5.5 or 5.6? It just ignores my datadir directive in the my.ini file (using the default data directory works fine).

 

It does take note of other commands such as moving the log files, but if the error log is loaded from the control panel (MySQL -> Error Log) it always loads the log from the default data directory and not the one I have specified. If this data directory is moved or deleted (with the added directives) nothing works at all. This was not an issue on the old Coral versions (think I was on 8.91).

 

Ultimately I want to make this install portable (on a USB3 key) for testing so I can just change a couple of lines in the config files and have it working on any machine, so being able to change this directory is pretty important for me.

 

Is this a known limitation or has the command name changed? If anyone can shed some light on this situation it would be appreciated!

 

Thanks in advance,

 

Paul

 

P.S. As a feature request it would be great to have several versions of MySQL / MariaDB be hot-swappable like with the PHP versions...

Link to comment
Share on other sites

Uniform Server ZeroXI is inherently portable, just copy folder UniServerZ and all its content to a USB memory stick and you are ready to go.

 

To achieve portability when running various flavours of MySQL and MariaDB required a few compromises. Notably in your situation restriction of the data folder. That said all you need to do is export your old databases and import them to ZeroXI.

 

Hot-swappable MySQL/MariaDB has been considered however unlike PHP, users tend to use a specific version of a database server and stay with that, hence hot-switching is unlikely to be implemented.

 

All the best

Ric

Link to comment
Share on other sites

Thanks for the quick response, Mike.

 

That's a shame because I have several directories on different secure (BitLockered) drives / machines that I need to swap between and they are of large enough sizes 40-100Gb that I don't want to be moving them!

 

Is there's no way I can undo the compromises on the data directory with some manual bodges? (I'm really only interested in MySQL) Would symlinks ("mklink /D <to> <from>" or whatever the junction syntax is) work here?

 

I would have thought hot-swap MySQL versions would be popular... I have sites running several combinations of PHP / MySQL and while Vagrant + virtual severs are useful, they're big, slow and awkward. Never mind, swapping them is not a big a deal manually - a directory rename seems to do that!

 

Cheers,

 

Paul

 

P.S. It's a small world, I live in Bishop's Stortford just down the road from you!

Link to comment
Share on other sites

Hi Paul

 

Lets take a step back!

Can you provide an example for the path you currently use:

datadir=path

 

For a portable installation what path will you use.

 

All the best

Ric

Link to comment
Share on other sites

Okay, so to give an example use case, lets say I have several secured drives, each containing something like:

 

X:\data (which would produce the line: datadir = "X:/data/" in my my.ini)

X:\vhosts

X:\www (site code)

 

And then I have a few extra manual defines in my httpd.conf (less now thanks to you using the same system extensively in Zero XI) which declare the last two of these variables. This means that when I swap drive I only need to update 3 lines (2 in httpd.conf and 1 in my.ini) and everything will just work.

 

I set all of my stuff up this way to keep it separate and this works very well in Uniform Server Coral (although I need a few extra defines there). This allows me to have only one version of the Server (and associated configs), but be able to run different sets of separate sites / data from it.

 

The symlinking solution works absolutely fine, so I now have some extra .bat files unmounting and mounting the correct directories for MySQL (the rest works fine already), but it would be nicer not to do this and use the inbuilt options as before (accidental data deletion is possible with symlinks when unmounting if using del and not rmdir!).

 

Normally this is not on a USB stick (but rather my main SSD), but it is handy to be able to use the same setup for other, older computers I use to test things where the data is in the same format with a single temporary copy to a USB stick.

 

Hope this is clearer!

 

Thanks,

 

Paul

Link to comment
Share on other sites

Well the British weather is conducive to looking at this type of problem.

 

Thanks for posting the above details. I have published a proposed solution on Source Forge in the development folder. Download UniController.exe using the following link:

http://sourceforge.net/projects/miniserver/files/Dev/

 

This new controller allows you to override the ZeroXI default MySQL data folder location.

 

You have two options as following:

 

Edit the Uniform Server configuration file C:\UniServerZ\home\us_config\us_config.ini at the bottom of this file add the following new section:

[MYSQL]
datadir=X:\data

Where X:\data is the absolute path to the data folder (Tested ).

 

 

Alternatively add the following section (Untested):

[MYSQL]
datadir=

This will disable the internal ZeroXI default datadir. Now edit the MySQL configuration file

C:\UniServerZ\core\mysql\my.ini and set the paths as for your Coral release.

 

I will check there are no side effects and if you confirm modifications meet your requirements I will add these to the next controller release (ZeroXI_controller_1_1_4.exe).

 

All the best

Ric

Link to comment
Share on other sites

Thanks for those! Both options work perfectly and meet my needs completely - the latter being my preference.

 

I'm not sure how the internal logic for the controller works, but it seems to me that the best possible operation in this case would be to parse the my.ini file on initialisation of the tray controller and use the datadir value from it if it exists / is uncommented or use the default directory (defined internally) if it isn't set (or just ensure it's always set in the default install). This behaviour should allow you to remove that option completely? I can only assume that there is some form of MariaDB incompatibility I'm missing with this method though!

 

Thanks again for your extremely quick support on this, I wish all software creators were so engaging with their users!

 

Cheers,

 

Paul

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...