Centos – MySQL with NFS as datadir on CentOS

centosMySQLnfs

I'm trying to set up MySQL using a NFS mount as datadir on CentOS.

When starting mysqld while using a mount I get this error:

chown: changing ownership of '/srv/mysql': Operation not permitted

I need to know which options I have to set to the NFS exports so MySQL can start and chown the mounted folders and files.

Best Answer

If possible I would make sure there is a mysql user and group on client and server with the same UID and GID. Make sure that the directory being exported and all the contents are owned by mysql:mysql. I'm not 100% but you may want to make the mountpoint on the client mysql:mysql before mounting the NFS share.

Running MySQL with its data files on NFS is not a particularly good design though. I hope you're not trying to run multiple servers from the same data files. I was amazed to have an I.T guy ask me if he could do this just the other day.