Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to mount my windows ntfs partition under Ubuntu 10.10 containing MySQL data folder (from windows) in /media/mysql/data.In my windows I have installed Sokkit (PHP+Apache+MySQL). In my Ubuntu I have installed Xampp and in the my.cnf I have pointed the datadir to /media/mysql/data. Now when I try to start the Xampp service MySQL fails to start.

Can you please tell me what could be the possible cause ?

I am using the following mount command.

mount -t ntfs -o defaults,no_root_squash /dev/sda1 /media/

Is there any other way to access my windows partition apart from mounting the partition ?

share|improve this question
add comment

2 Answers

Generally speaking this is a bad idea. Database software need tight control of the files they use (for obvious reasons). If you put your database files on NTFS on Linux, you're asking for trouble.

Write support for NTFS on Linux is (afaik) still rather experimental. I have no idea how well-behaved file locking is on this combination.

My advice would be to export the database from windows using mysqldump or something like that, and rebuild the database on the linux side using that dump - with the data on a native filesystem (ext, xfs, reiserfs, ... whatever you feel is best).

share|improve this answer
    
it was probably some issue with Sokkit on Windows. When used Xampp on both windows and Linux it worked. Thanks for all the help. –  Supratik Mar 30 '11 at 18:11
add comment

I've been struggling with the same (or a similar?) problem for several days and for me I found a solution:

  1. The problem:

    For whatever reason mysql needs its database to be owned by the user "mysql" (/etc/mysql/my.cnf provides a "user"-option, but changing this to the owner of the mounted ntfs-partition did not change anything)

  2. The solutions:

    a) straight forward: Mount the ntfs-partition as user "mysql" - my /etc/fstab would look like:

    /dev/sda5  /mnt/ntfsmount/  ntfs  rw,user,auto,umask=0002,uid=121,gid=113
    

    where uid=121 is the user id of "mysql" and gid=113 is the group id of "mysql" (adopt as required!)

    This was not satisfactory to me as the partition holds way more data than only some mysql databases

    b) recommended: Mount the ntfs partion with arbitrary permissions and options and "bind" the mysql data to a separate mountpoint (see above for an example - except for the uid and gid options):

    Next you need to have "bindfs" installed

    sudo apt-get install bindfs
    

    Now, with your ntfs-partion mounted and bindfs installed, you need to add something like

    bindfs#/mnt/ntfsmount/mysql /mnt/mysql fuse owner=mysql,group=mysql,perms=755 0 0
    

    to your /etc/fstab. This will by default mount the mysql-database with the appropriate ownership and permissions to the specified directory. Now your /etc/mysql/my.cnf needs to point to "/mnt/mysql/data" and your mysql database should be accessible after the next reboot (or mount of /mnt/mysql and restart of mysql service)

  3. Annotations:

    I've tried this on Kubuntu 11.04 but I think this is a more general problem and should work with various versions of debian-like systems.

    Before I worked out this solution I searched on the web and found an advice to de-activate/de-install "apparmor". I'm not sure if this is relevant for solution b) described above but I did so in advance. So if b) does not work as expected you may want to uninstall apparmor.

    sudo apt-get remove apparmor
    

--

I hope this will be helpful to some of you!

Regards, Ludwig

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.