Archive for March, 2009

Backup of all MySQL databases

To backup all MySQL databases on a machine, use the following command: -

mysqldump -u root -psecret –all-databases > backup.sql

To restore all databases, use the following command: -

mysql -u root -psecret < backup.sql

To restore a single database (from a cpanel backup etc), use the following command: -

mysql -u user -psecret dbname < dbbackup.sql

Starting a VM from the Command Line

Starting a VM from the Command Line (or via a shortcut on the desktop) is easy – just use the command: -

VBoxManage startvm name_of_virtual_machine

for example : -

VBoxManage startvm “Windows XP”

USB in VirtualBox

Here are the steps required to get USB working on a Linux host (tested with VirtualBox 2.1.4)

1. Create a group usbusers and put yourself in it.

sudo addgroup usbusers
usermod -a -G usbusers andy

2. Note down the vendor and id numbers for the USB devices that you want to enable after running the following command: -

VBoxManage list usbhost

3. In VirtuaBox’s USB section add both of these devices, making sure you have the vendor and id numbers correct.

4. Add the following lines in /etc/fstab (you can get the ID of the usbusers group by looking in /etc/group) : -

# usbusers is the USB group (id 1001)
none /proc/bus/usb usbfs devgid=1001,devmode=664 0 0

5. A reboot is required.