MySQL dump

Posted under » MySQL on 8 October 2009

There may be MySQL workbench, phpmyAdmin etc. but this method works, reliable and is most secure.

if windows

cd c:/mysql/bin

Basic dump

~$ mysqldump -u root -p database_name > database.sql

Specific table

~$ mysqldump -u... -p... mydb t1 t2 t3 > mydb_tables.sql

It's not advisable to put the password. Another user might check the cmd history.

If somehow the MySQL give out memory error, you can increase it without changing the MySQL config or the my.ini file by

~$ mysqldump -u root -p database_name > database.sql --max_allowed_packet=9999M


~$ mysql -u #username# -p #database# < #dump_file#

If cannot try this first

~$ mysql -u root -p databasename 

web security linux ubuntu GIT svn Raspberry apache mysql php drupal cake symfony javascript Ajax css