Jump to content


Photo

MySQL data directory

mysql data directory

  • Please log in to reply
6 replies to this topic

#1 paul_norman_81

paul_norman_81

    Newbie

  • Member
  • Pip
  • 4 posts
  • Main OS: Windows 7

Posted 23 May 2014 - 10:50 AM

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...



#2 Ric

Ric

    Project Manager

  • Admin
  • PipPipPipPipPip
  • 1,535 posts
  • Gender:Male
  • Location:Cambridge,UK
  • Interests:Electronics
    Internet in general
    Open source projects
  • SourceForge IDmpgcan
  • Wiki ID: Ric
  • Main OS: Windows XP

Posted 23 May 2014 - 01:49 PM

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



#3 paul_norman_81

paul_norman_81

    Newbie

  • Member
  • Pip
  • 4 posts
  • Main OS: Windows 7

Posted 23 May 2014 - 02:49 PM

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!



#4 Ric

Ric

    Project Manager

  • Admin
  • PipPipPipPipPip
  • 1,535 posts
  • Gender:Male
  • Location:Cambridge,UK
  • Interests:Electronics
    Internet in general
    Open source projects
  • SourceForge IDmpgcan
  • Wiki ID: Ric
  • Main OS: Windows XP

Posted 23 May 2014 - 06:10 PM

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



#5 paul_norman_81

paul_norman_81

    Newbie

  • Member
  • Pip
  • 4 posts
  • Main OS: Windows 7

Posted 24 May 2014 - 05:02 AM

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



#6 Ric

Ric

    Project Manager

  • Admin
  • PipPipPipPipPip
  • 1,535 posts
  • Gender:Male
  • Location:Cambridge,UK
  • Interests:Electronics
    Internet in general
    Open source projects
  • SourceForge IDmpgcan
  • Wiki ID: Ric
  • Main OS: Windows XP

Posted 24 May 2014 - 07:33 AM

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.n...rver/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



#7 paul_norman_81

paul_norman_81

    Newbie

  • Member
  • Pip
  • 4 posts
  • Main OS: Windows 7

Posted 25 May 2014 - 06:34 AM

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







Also tagged with one or more of these keywords: mysql, data directory

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users