Knowledge Walls
John Peter
Pune, Maharashtra, India
Dumping Database in MYSQL in Mysqldump of MySQL
5547 Views
Example
mysqldump -u root -pmysql -h localhost db_name > file_name.sql
Importing dump to mysql 
zcat abc.sql.gz | mysql -u root -p database
Dumping database with Procedures
mysqldump -u root -pmysql -h localhost db_name --routines > file_name.sql
Dumping database with Create table and no data
mysqldump -u root -pmysql -h localhost db_name --no-data > file_name.sql
Dumping database with data only [No create table's]
mysqldump -u root -pmysql -h localhost db_name --no-create-info > file_name.sql
Copying database from host to host
mysqldump -u root -pmysql -h from_host db_name | mysql -u root -pmysql -h to_host db_name
Copying localdb to another db with routines
mysql: create database new_database_name;
cmd: mysqldump -u root -pmysql old_database_name --routines | mysql -u root -pmysql new_database_name;
Dumping multiple databases
mysqldump -u root -pmysql --databases db1 db2 > file_name.sql
Dumping all databases
mysql -u root -pmysql --all-databases > file_name.sql
Dumping with Gzip in Linux 
mysql -u root -pmysql database --routines | gzip > filename.sql.gz
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details