Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder nexosis's Avatar
    Join Date
    Dec 2006
    Posts
    120
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how do I save a mysql file? i'm new to mysql...

    How do we save sql files? well i'm new to them and wanted toknow how.

    progress: HTML: 100% > CSS: 90% > Javascript: 55% > Php:10%
    Want an avatar like mine? it's free! just pm me.

  • #2
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,631
    Thanks
    4
    Thanked 147 Times in 138 Posts
    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:

    Code:
    mysql -uusername -psecretpassword databasename
    then change to this:

    Code:
    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.

  • #3
    Regular Coder nexosis's Avatar
    Join Date
    Dec 2006
    Posts
    120
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for the help.

    progress: HTML: 100% > CSS: 90% > Javascript: 55% > Php:10%
    Want an avatar like mine? it's free! just pm me.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •