dumping mysql and importing mysql
One thing that a developer has to do during the course of a project is to export a mysql database so that he can set up a new development environment, transfer data, etc.
In mysql, the mysqldump command works great for this:
mysqldump –verbose -user -h [hostname] -p[password] [database_name] > file.sql
When importing a sql file, just go the other way:
mysql -u [username] –verbose -p[password] -h [hostname] [database_name] < file.sql
This two commands will make importing and exporting databases a snap.
I would also add the –add-drop-table option to your mysqldump command, to make it more portable, and -c to use complete inserts, in case you want to munge the data later.
You never know when or where your sql file will come in handly later.
Eric Marden
4 Aug 09 at 7:14 am