database disappeared in Scotchbox

85 views
Skip to first unread message

Ian Robert Douglas

unread,
Jan 27, 2016, 8:22:58 AM1/27/16
to Vagrant

Hi,


I’m a bit freaked out. Posting this in case anyone can help.


I've used Scotchbox for a while for different projects. It's great, but yesterday I encountered a critical problem. I don’t think the problem is in Scotchbox as such, but I don’t know how to fix it.


Recently I was building a Wordpress site, and all was fine. Yesterday I start up that Scotchbox install as usual (via Vagrant Manager under OSX10.11.2) and go to my custom url (name.dev) and I get the initial window you find in Wordpress before a database has been created.


I immediately halted the Scotchbox VM.


Opening Virtualbox, I can see (for reasons unknown) three VMs with the name I chose for the project: one whose name I edited in Virtualbox when I first created the project (getting rid of "default” and the number string in its name), and another two with "name_default_xxxxxxxxxxxxxx".


What I hope is that for some reason Vagrant Up is starting the wrong box, and that in one of those VMs is my database. 


This is my Vagrantfile:


Vagrant.configure("2") do |config|


    config.vm.box = "scotch/box"

    config.vm.network "private_network", ip: "192.168.33.20"

    config.vm.hostname = “name.dev"

    config.vm.synced_folder ".", "/var/www", :mount_options => ["dmode=777", "fmode=666"]

    config.ssh.username = "vagrant"

    config.ssh.password = "vagrant"

    

end


When I start up the VM from Vagrant Manager, and then use Sequel Pro to SSH into the my custom private network IP, I can get in, see the database (named scotchbox, the default name), open it, but there's no tables there.


Again: maybe Vagrant is starting up the wrong VM? If so, I have no clue how this happened.


So: 


1) Is there a way to repoint my Vagrantfile so it starts up, in turn, the other two VMs that show up in Virtualbox? That way, I can start them up and see if my Wordpress site is alive and well in one of them.


2) Is there any other way of physically tracing my database in my file system, or even the file system of the three VMs? Where does Scotchbox store databases??



I'm pretty screwed if I lost that database. I didn't (stupidly) take a backup within Wordpress. I can think of no reason or action that would wipe it. But I did update the Virtualbox app itself, and the Extension Pack. But that's pretty much all I changed recently.


Worryingly, my other Scotchbox installs appear to be okay.


Any thoughts, help or guidance much appreciated!



In replies, as I’m not technically strong, please explain as if talking to a small child, or a labridor.


best,

ian

Ian Robert Douglas

unread,
Jan 27, 2016, 11:10:08 AM1/27/16
to Vagrant
So, continuing to research and try to answer my own question, I come across this thread that seems to suggest that you can replace the file "id" in project_ folder/.vagrant/machines/default/virtualbox/

I was able to get the UUIDs of the three VMs that relate to my project by running the Terminal command VBoxManage list vms when in the directory that contains the Vagrantfile of my project.

I then created three files with the name "id" in folders on my Desktop, by running the following command in each folder successively:

echo -n '<UUID number>' > id

This helps prevent adding any extra lines by a text editor that might trip up Vagrant later on.

The UUID looks something like this: 9926dcae-cd93-4ca5-b8ca-48a92c239d2d

So now I have my three id files, can I just move them over one at a time and run vagrant up to see if the particular VM the id relates to has my full project (i.e., the missing database)?

I'm concerned not to make a bad situation worse by making extra mistakes.

And my other question still stands: Where does Scotchbox store databases? Does anyone know?

Thanks,
ian 

Ian Robert Douglas

unread,
Jan 27, 2016, 2:47:07 PM1/27/16
to Vagrant
I went ahead of used the following command in Terminal while in my project directory to write over the id file with the VM UUID I hoped was where my site was, and it worked. Database appears linked to the alternate VM. No idea why Vagrant replaced it with an empty duplicate ...

echo -n "<VM UUID here>" > .vagrant/machines/default/virtualbox/id
Reply all
Reply to author
Forward
0 new messages