How to export a mysql database via the linux command line
Prerequities:
You need to have MySQL client installed.
Dumping a database is usefull when moving data and backup data.
These examples shows you how to export a database. It is a good idea to export your data often as a backup.
First connect to the mysql server that has the database and use this command line.
mysqldump -u username -ppassword database_name > database_name.sql
Replace username, password and database_name with your MySQL username, password and database name. File database_name.sql now holds a backup of your database, download it to your computer.
Or
you can do this from your Linux shell
mysqldump -u username -h hostname.of.server.com -ppassword database_name > database_name.sql
Gunzip
mysqldump -u username -h localhost -p database_name | gzip -9 > backup_db.sql.gz
mysqldump -u username -h localhost -p database_name | bzip2 -c > backup_db.sql.bz2
This will remotely connect to the server and download it if you're remote.
Tags
Links
- heshan's blog
- 310 reads
-
Comments
Post new comment
Tags in Custom Tags
Web Service
Perl Module
Performacne Test
Ubuntu
Trac
PHP over Jsp
Ruby on Rails
Netbeans
Mac OS X
Facebook
Leopard
NuSOPA
Apple
Webservice
MSN
Drupal
MySQL
PHP vs Jsp
Workflow
JSP
Perl Funciton
NuSOAP
Yahoo
Drupal Modules
Dual Boot
Ubuntu 9.10
Object-Oriented
Wikipedia
OOP
Folder
Gmail
Projet Management
Mobile web
mysqldump
Zend Studio for Eclipse
Pidgin
Perl
PHP Clases
Video Module
Opera mini
Wiki
Unix
PHP
ASP .NET
x-send
PHP JSP Performance
Thread
Drupal Themes
.NET
PHP functions
