Unable to change datadir database location in mysql

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

Unable to change datadir database location in mysql

Postby marksix » 27. November 2014 20:01

I am using XAMPP Mac and I have the need to change the default mysql database location. In XAMPP windows, it was a case of adding the line to the my.ini file:

datadir = "MY DRIVE"

In XAMPP for mac the config file is now my.cnf and I added the following:

datadir=/Volumes/KINGSTON/mysql/data

The XAMPP panel (manager-osx.app) allows me to start the mysql process and I can access databases correctly through phpmyadmin. However, after making the datadir change, the status indicator goes from amber to red and the Status turns to "Stopped". However the mysql process continues to run! If I rem out the datadir line and restart mysql it works perfectly so my issue is to do with the added line.

The excellent What's keeping me Application tells me that the mysql process continues to run after the XAMPP panel shows it as stopped and I therefore cannot eject the drive. It would seem that I am confusing the XAMPP control panel and it cannot detect the mysql status correctly since changing the datadir. Are there any other lines to add to my.cnf file? How would you do this?
marksix
 
Posts: 2
Joined: 27. November 2014 19:57
Operating System: Mac

Re: Unable to change datadir database location in mysql

Postby Nobbie » 27. November 2014 21:49

marksix wrote:datadir=/Volumes/KINGSTON/mysql/data


Does MySQL (i.e. the User, which executes the MySQL Server) have sufficient rights for this folder?
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: Unable to change datadir database location in mysql

Postby chopstik » 28. November 2014 00:53

I'm seeing the very same issue. Been happening for a while. Re-installed XAMPP once again today and everything works well, as normal until you add a new datadir line to my.cnf...

Code: Select all
Add -> datadir = /Volumes/WAHOO~OSX/Sites/xampp/mysql
     to the [mysqld] configuration in /Applications/XAMPP/xamppfiles/etc/my.cnf


MySQL will start once and work from the new datadir, but the status light will remain red whereas on a new install it went green no problem.
I then need to restart completely to be able to start MySQL once more.

Does MySQL (i.e. the User, which executes the MySQL Server) have sufficient rights for this folder?


The external drive the datadir is pointing towards - what sort of rights would it need, execute? The permissions I'm seeing on that external drive are - which seem wide open, no?
Code: Select all
drwxrwxrwx  56 _unknown  _unknown   1904 28 Nov 12:42 mysql
chopstik
 
Posts: 1
Joined: 28. November 2014 00:46
Operating System: OSX 10.10.1

Re: Unable to change datadir database location in mysql

Postby marksix » 28. November 2014 09:13

I am using a removable USB flash drive which is formatted as FAT32, therefore permissions for root and mysql cannot be granted due to the filesystem.
Perhaps this is the reason for the issue?
marksix
 
Posts: 2
Joined: 27. November 2014 19:57
Operating System: Mac

Re: Unable to change datadir database location in mysql

Postby Nobbie » 28. November 2014 14:53

marksix wrote:I am using a removable USB flash drive which is formatted as FAT32, therefore permissions for root and mysql cannot be granted due to the filesystem.
Perhaps this is the reason for the issue?


No, the problem is the Drive Letter, this is only known to the logged in User which may differ from the System user, which executes MySQL. If you would like to use USB Flash Drive, you *must* *not* run MySQL as a service. You *must* start it manually after you have logged in and after you plugged in the USB Stick, and it must not be a service. In any other case the USB Drive letter is unknown to MySQL.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04


Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 13 guests