如何更改 Debian 中已安装的 virtualbox 共享文件夹的所有权/权限?

如何更改 Debian 中已安装的 virtualbox 共享文件夹的所有权/权限?

我正在尝试挂载一个共享文件夹并将其用作 mysql 数据目录。

成功安装并设置我的 datadir 配置后,mysqld 失败,因为它缺少适当的权限

我已将其挂载到 /var/lib/mysql,之前使用 /srv/sql 的尝试也遇到了同样的问题:

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

尝试运行chown -R mysql:mysql /var/lib/mysql没有任何区别,创建子文件夹并尝试使用它也没有区别。

这是 syslog 中的 mysql 条目:

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]:

VM 本身安装了 Debian 6,并进行了少量更改(我更改了 my.cnf 以使用不同的数据目录,然后又改回来了)。主机是 OS X Mountain Lion 和 Virtualbox 4.2.6,安装了附加组件/扩展程序和 USB 插件

答案1

请尝试使用 mysql 用户 ID 手动挂载共享文件夹:

以下是一个例子:

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

那么你会这样做:

$ sudo mount -t vboxsf share_name -o rw,dmode=777,gid=112,uid=105 /var/lib/mysql

相关内容