MySQL | Backup and restoration using mysqldump

The mysqldump client is a utility that dumps one or more MySQL database for backup or transfer to another SQL server. It can be used to dump one table at a time as well. All that is required is connectivity to the database server and access privileges to the database.

Backup a single table.

mysqldump -u username -p db_name table_name > table_name_dump.sql

Backup multiple tables.

mysqldump -u username -p db_name table1_name table2_name > dump.sql

Restore the single table back to the database.

mysql -u username -p db_name < /path/to/table_name_dump.sql

Backup an entire database. The command can be altered to backup multiple databases just like tables.

mysqldump -u username -p db_name > db_backup.sql

Backup all the databases in the server.

mysqldump -u username -p --all-databases > all_db_backup.sql

Restore the database.

mysqldump -u username -p < db_backup.sql

VirtualBox Guest Additions on Linux | Missing kernel headers

If you think the VirtualBox Guest Additions has not installed correctly/completely, do the following:

sudo /etc/init.d/vboxadd setup

If there are any error messages, please refer to the following file for hints.


If there are errors similar to the one shown below, read further for the solution.

/tmp/vbox.0/Makefile.include.header:97: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again.  Stop.

Install the headers for the current running kernel.

sudo apt-get install linux-headers-$(uname -r)

Re-install the Guest Additions.

sudo /etc/init.d/vboxadd setup

Try if things are working fine. Say mount a shared folder.

sudo mount -t vboxsf share /home/jack/host

The above scenario was faced and resolved on Debian Squeeze. The commands should hold good for any Linux distro.