Access datadir folder by VM

2

My scenario is as follows:

  • / media / data / svr / mysql
    Where is my mysql datadir folder located.

The development environment is running in vagrant (debian 6), with php 53 and mysql 5.5

I configured the VM to access the datadir folder via NFS.  The df -h command shows this:

Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/debian--607--x64--vbox4210-root
                      9.1G  1.4G  7.3G  16% /
tmpfs                 249M     0  249M   0% /lib/init/rw
udev                  244M  120K  244M   1% /dev
tmpfs                 249M     0  249M   0% /dev/shm
/dev/sda1             228M   16M  201M   8% /boot
192.168.53.1:/media/dados/svr/mysql
                       93G  4.7G   83G   6% /home/vagrant/servidor
/var/www               93G  9.4G   83G  11% /var/www
/vagrant              183G   56G  127G  31% /vagrant
/tmp/vagrant-puppet-1/manifests
                      183G   56G  127G  31% /tmp/vagrant-puppet-1/manifests

The command ls -al executed inside the VM running in vagrant shows the permission of the folder like this: drwxrwxr-x 6 115 125 4096 Apr 14 21:39 server /

My question is how to make mysql use the / home / vagrant / server folder?

In the file my.cnf already informed the path of the datadir as datadir = / home / vagrant / server - but failed.

When I reported: datadir = 192.168.53.1:/media/dados/svr/mysql the system showed the error message -

** / etc / init.d / mysql: ERROR: The partition with

  

192.168.53.1:/media/dados/svr/mysql is too full! ... failed!

How to make the virtual machine enteder that the datadir folder of mysql is on the drive / data / svr / mysql mounted via nfs?

    
asked by anonymous 14.04.2014 / 23:59

1 answer

1

Anyone interested could solve the sharing and access problem as follows:

In the Vagrantfile file generated by PuPHPET, I added the owner and group at the time that it mounts the folder. Saying that the owner of the folder will be mysql and the mysql group.

data['vm']['synced_folder'].each do |i, folder|
    if folder['source'] != '' && folder['target'] != '' && folder['id'] != ''
      nfs = (folder['nfs'] == "true") ? "nfs" : nil
      config.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{folder['id']}", **owner: "mysql", group: "mysql",** type: nfs
    end
  end

In the config.yaml file, I created the share as below.

 synced_folder:
            0C0LWqoKUqOI:
                source: /media/dados/svr/mysql
                target: /home/vagrant/servidor
                nfs: 'false'

To end after quitting mysql on the virtual machine, I changed the path of the var / lib / mysql datadir to / home / vagrant / server

From this I started mysql and it worked.

    
16.04.2014 / 00:59