|Version 2 (modified by nhruby, 5 years ago)|
Using mysqldump for backups
MySQL is offered to projects as part of the Project database offering. Project admins are encouraged to backup their databases on a regular basis. SourceForge.net provides phpMyAdmin for backup and administration tasks and additionally provides the mysqldump command line tool for backup operations by advanced users.
Detailed discussion of the mysqldump tool is beyond the scope of this document. For further information please refer to the MySQL Backup and Recovery extract and the MySQL Reference Manual for mysqldump. Note also that the linked-to documents at the MySQL site may not reflect the current version of MySQL deployed on SourceForge.net servers. Please always verify the version of MySQL in use and ensure you are reading the corresponding documentation.
The following example assume you are using a UNIX environment. The below may work on Windows but users are advised to use Cygwin for better compatibility.
- First determine your method of access to the database and make any required connections
- Next, run the mysqldump command. The below example also compresses the dump file and adds the date to the filename. Please replace DATABASE with the name of your database and DATABASE_USER with the name of your database user:
mysqldump -h mysql-LETTER.sourceforge.net --user=DATABASE_USER --opt -p DATABASE | gzip > DATABASE.`date +%Y-%m-%d`.sql.gz
- When complete, remove any temporary files you may have created.