View Full Version : how do I save a mysql file? i'm new to mysql...

03-18-2007, 05:36 PM
How do we save sql files? well i'm new to them and wanted toknow how.

03-18-2007, 07:52 PM
you have two choices. If you are working on a database or table that you want to save then you can use SELECT INTO OUTFILE syntax where you specify the file you want to save into.

If you want to save everything you type into your mysql client then you can start the client with the --tee option which saves all you type into a file, table creations, inserts, deletes etc. etc.

so if you normally start mysql like this:

mysql -uusername -psecretpassword databasename

then change to this:

mysql -uusername -psecretpassword databasename --tee pathtoyourfile/filename.sql

note that you can't overwrite the file (or maybe able to but I can't find out how) so you would start it with a new file name each time.

03-19-2007, 03:50 PM
thanks for the help.