Skip directly to content


on Sat, 04/02/2011 - 10:08

Dump all databases

MySQL :: MySQL 5.0 Reference Manual :: 4.5.4 mysqldump — A Database Backup Program

You can dump all databases by:

# mysqldump [options] --all-databases An example would be:

# mysqldump -u root -p --all-databases > all_dbs.sql If you just want to dump several databases into one file: # mysqldump [options] --databases db_name1 [db_name2 db_name3...]

An example would be:

# mysqldump -u SomeUser -p --databases mydb1 mydb2 mydb3 > myDbs.sql

Import database

mysql -p -h DBSERVER dbname < dbname.sql
Or with charset: mysql -uUSERNAME -pPASSWORD --default-character-set=utf8 USER_DATABASE < backup.sql

Repair table

MyIsam tables can be corrected with:

REPAIR TABLE <table>;  or for more options, with  myisamchk --safe-recover 

Read more on:  and

To sum up: login to your MySQL server with

mysql -uroot -p <skriv credentials>

use <database>

CHECK TABLE tbl_name [, tbl_name] ... [option] ... || eller myisamchk table (



Post new comment