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'm trying to mount a shared folder and use it as the mysql datadir.

Having succesfully mounted and setup my datadir config, mysqld fails because it lacks the appropriate permissions

I have it mounted to /var/lib/mysql and earlier attempts with /srv/sql ran into the same issue:

drwxr-xr-x  1 root    root     272 Feb 27 12:22 mysql

Trying to run chown -R mysql:mysql /var/lib/mysql makes no difference, as does creating a subfolder and trying to use that.

Here's the mysql entries in syslog:

Feb 27 12:22:23 tomjn-debian-dev-vm mysqld_safe: Starting mysqld daemon with databases from /var/lib/mysql
Feb 27 12:22:23 tomjn-debian-dev-vm mysqld: 130227 12:22:23 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
Feb 27 12:22:23 tomjn-debian-dev-vm mysqld: 130227 12:22:23 [Note] Plugin 'FEDERATED' is disabled.
Feb 27 12:22:23 tomjn-debian-dev-vm mysqld: #007/usr/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
Feb 27 12:22:23 tomjn-debian-dev-vm mysqld: 130227 12:22:23 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
Feb 27 12:22:24 tomjn-debian-dev-vm mysqld: 130227 12:22:24  InnoDB: Initializing buffer pool, size = 8.0M
Feb 27 12:22:24 tomjn-debian-dev-vm mysqld: 130227 12:22:24  InnoDB: Completed initialization of buffer pool
Feb 27 12:22:24 tomjn-debian-dev-vm mysqld: 130227 12:22:24  InnoDB: Operating system error number 13 in a file operation.
Feb 27 12:22:24 tomjn-debian-dev-vm mysqld: InnoDB: The error means mysqld does not have the access rights to
Feb 27 12:22:24 tomjn-debian-dev-vm mysqld: InnoDB: the directory.
Feb 27 12:22:24 tomjn-debian-dev-vm mysqld: InnoDB: File name ./ibdata1
Feb 27 12:22:24 tomjn-debian-dev-vm mysqld: InnoDB: File operation call: 'open'.
Feb 27 12:22:24 tomjn-debian-dev-vm mysqld: InnoDB: Cannot continue operation.
Feb 27 12:22:24 tomjn-debian-dev-vm mysqld_safe: mysqld from pid file /var/run/mysqld/mysqld.pid ended
Feb 27 12:22:39 tomjn-debian-dev-vm /etc/init.d/mysql[5085]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
Feb 27 12:22:39 tomjn-debian-dev-vm /etc/init.d/mysql[5085]: #007/usr/bin/mysqladmin: connect to server at 'localhost' failed
Feb 27 12:22:39 tomjn-debian-dev-vm /etc/init.d/mysql[5085]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Feb 27 12:22:39 tomjn-debian-dev-vm /etc/init.d/mysql[5085]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
Feb 27 12:22:39 tomjn-debian-dev-vm /etc/init.d/mysql[5085]:

The VM itself has debian 6 with apache/php/mysql installed with minimal changes ( I changed my.cnf to use a different datadir then changed it back ). Host machine is OS X Mountain Lion and Virtualbox 4.2.6 with the additions/extensions installed and the USB addon

share|improve this question

1 Answer 1

up vote 1 down vote accepted

please try to mount the shared folder manually using the mysql user id:

Here is an example:

$ id mysql
uid=105(mysql) gid=112(mysql) groups=112(mysql)

then you would do:

$ sudo mount -t vboxsf share_name -o rw,dmode=777,gid=112,uid=105 /var/lib/mysql
share|improve this answer
    
Thanks, this mounted the folder, and it appears to have given it the right permissions according to ls -al, will the command to mount be the same or will I need to figure out the gid every time? mysqld starts from the looks of it but talks about upgrade of tables necessary, but I think that's a different issue –  Tom J Nowell Feb 27 '13 at 14:22
    
Yes, i think that is a different issue. The uid and gid are constant on the system. Also "dmode=777" from the mount command, gives read-write permissions to everyone. You can try to automate the mount by editing /etc/fstab, so you don't need to run the command every time you boot the VM. –  pincoded Feb 27 '13 at 20:30

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.