Tuesday, May 20, 2008

DUMP MYSQL

OOoops!!!! did i say something wrong. Mysql is the best SQL database with lot of inbuilt functions, not just leaving you to the drag and drop stuff put encourages you to use your very own brain and come with queries!!! well thsi blog is not about to encourage and to pomp and show about mysql but this is where i will say how to take backup of your mysql database.

LINUX BASED USERS:
The most common use of mysqldump is probably for making a backup of an entire database:

shell> mysqldump --opt db_name > backup-file.sql

You can read the dump file back into the server like this:

shell> mysql db_name < backup-file.sql

Or like this:

shell> mysql -e "source /path-to-backup/backup-file.sql" db_name

mysqldump is also very useful for populating databases by copying data
from one MySQL server to another:

shell> mysqldump --opt db_name | mysql --host=remote_host -C db_name

It is possible to dump several databases with one command:

shell> mysqldump --databases db_name1 [db_name2 ...] > my_databases.sql

If you want to dump all databases, use the --all-databases option:

shell> mysqldump --all-databases > all_databases.sql

oKE OKE YOUR AN WINDOWS USER:

"C:\Program Files\MySQL\MySQL Server 5.0\bin"\mysqldump -uBackup -pBackup %db% >c:\backup\%db%.sql

1 comment: