MySQL SSH Export and Import Database in Shell Terminal

In your favorite shell you can export a MySQL database and Import using the following.
on Ubuntu, my MySQL databases are located at
/var/lib/mysql/database_name
To Export a MySQL Database run:

mysqldump -v -u username -p database_name > dumpfile.sql

To Import a MySQL Database run:

mysql -v -u username -p database_name < dumpfile.sql

Source: http://stuffthatspins.com/2011/05/06/mysql-ssh-export-and-import-database-in-shell-terminal-dump/

UBUNTU check free memory and free mem empty cache

check memory usage:

cat /proc/meminfo

or

free

free command displays amount of total, free and used physical memory (RAM) in the system, as well as shoing information on shared memory, buffers, cached memory and swap space used by the Linux kernel.

Syntax of free

free -[options]

Example usage of free

free -m

The command will display information about physical memory in MB.

free -m -s 5

The command will activate continuous polling delay at 5 seconds apart, and then display memory status in megabytes on terminal. Any floating point number for delay can be specified.

free -t -m

Same with “free -m”, but -t switch will display a line containing the totals of physical memory and swap space.

vmstat

vmstat reports report virtual memory statistics, which has information about processes, swap, free, buffer and cache memory, paging space, disk IO activity, traps, interrupts, context switches and CPU activity. With vmstat command, administrators can has instantaneous reports on memory usage.

Syntax of vmstat

vmstat -[options] [delay count]

Example usage of vmstat

vmstat

The command will display report based on averages since last reboot.

vmstat 5

The command will pool average system resources usage level for a sampling period of 5 seconds at interval of 5 seconds, except the first result that is averages since the last reboot.

empty / free up memory caches

To free pagecache:
echo 1 > /proc/sys/vm/drop_caches

To free dentries and inodes:

echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:

echo 3 > /proc/sys/vm/drop_caches

As this is a non-destructive operation and dirty objects are not freeable, the user should run “sync” first!

This was originally found @ http://www.linuxinsight.com/proc_sys_vm_drop_caches.html

Source: http://stuffthatspins.com/2011/01/20/ubuntu-check-free-memory-and-free-mem-empty-cache/

 
2012 upshell | Header Image by Game Wallpapers
Avatar Gamezine Designed by Cheapest Tablet PC
Supported by Phones 4u