Mysql
如何更改 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]:
虛擬機本身安裝了 apache/php/mysql 的 debian 6,改動很小(我將 my.cnf 更改為使用不同的 datadir,然後將其改回)。主機是 OS X Mountain Lion 和 Virtualbox 4.2.6,安裝了附加/擴展和 USB 外掛
請嘗試使用 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