Jump to content

[SOLVED] mySQL Export Statement?


blackcell

Recommended Posts

I am wanting to be able to export a table via the sql statement.  Within phpmyadmin, it works great for showing the sql statement for every other move you make within the program but when I export it basically gives me the sql query to recreate the table through sql.  I want to know how to initiate the export because I want to pull the sql command it currently gives me into a text file.

Link to comment
Share on other sites

I need to know if there is a sql command to basically give me the sql statement to duplicate a table containing information.  I want to use it to build a light interface to backup selective tables.  I know programs exist to do such things but I want to create my own.  I just don't know if the manner in which myphpadmin's export function to give the user the sql statement to replicate the table is an intensive background operation.

 

Does that make sense?  Let me know if it doesn't I shall try to re-word.

Link to comment
Share on other sites

I have looked around for some stuff on 'SELECT INTO OUTFILE' and I'm not understanding it completely or am looking at wrong information.  Could you give me an example of how to use this within php to achieve my desired result.  Nothing complicated, just an example sql.

Link to comment
Share on other sites

Maybe I don't have it from here!!!!

 

Here is my mysql:

 

SELECT * FROM `test` INTO DUMPFILE '//PC001/itdep/dump1.txt' LIMIT 0 , 30 

 

and I get this error:

 

#1064 - You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use 
near 'LIMIT 0 , 30' at line 4 

 

I know the answer to my problem is right in front of me but I just started getting deeper into mysql.  Until now I never needed to use much of it.

 

Thanks in advance.

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...

Whats the worst case scenario if table is being accessed while exporting the file? I know it can't be good and remembering that you can't do this basically kills my selective automatic backup method I had.

Not sure... I don't remember how the files are locked... but in principle, you may get inconsistent tables.  A simple LOCK should remedy this.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.