blackcell Posted January 11, 2008 Share Posted January 11, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/85563-solved-mysql-export-statement/ Share on other sites More sharing options...
blackcell Posted January 11, 2008 Author Share Posted January 11, 2008 Or is phpmyadmin hiding very intensive data processing through graphical interface? Quote Link to comment https://forums.phpfreaks.com/topic/85563-solved-mysql-export-statement/#findComment-436634 Share on other sites More sharing options...
fenway Posted January 11, 2008 Share Posted January 11, 2008 Export a table into what? Quote Link to comment https://forums.phpfreaks.com/topic/85563-solved-mysql-export-statement/#findComment-436767 Share on other sites More sharing options...
blackcell Posted January 11, 2008 Author Share Posted January 11, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/85563-solved-mysql-export-statement/#findComment-436834 Share on other sites More sharing options...
blackcell Posted January 11, 2008 Author Share Posted January 11, 2008 Oh if it helps and your fuzzy on myphpadmins process of backing tables, then look here: Click [Export] > Select sql as output > Copy the sql statement to reproduce the table. Quote Link to comment https://forums.phpfreaks.com/topic/85563-solved-mysql-export-statement/#findComment-436837 Share on other sites More sharing options...
blackcell Posted January 14, 2008 Author Share Posted January 14, 2008 After some more on mysql I have found that it has to do with the view dump. Cant find any information on where to go from there. Quote Link to comment https://forums.phpfreaks.com/topic/85563-solved-mysql-export-statement/#findComment-439240 Share on other sites More sharing options...
fenway Posted January 15, 2008 Share Posted January 15, 2008 You can use SELECT ... INTO OUTFILE. Quote Link to comment https://forums.phpfreaks.com/topic/85563-solved-mysql-export-statement/#findComment-439436 Share on other sites More sharing options...
blackcell Posted January 15, 2008 Author Share Posted January 15, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/85563-solved-mysql-export-statement/#findComment-440156 Share on other sites More sharing options...
fenway Posted January 15, 2008 Share Posted January 15, 2008 It's just like any other select, example you store the result set in a file. Quote Link to comment https://forums.phpfreaks.com/topic/85563-solved-mysql-export-statement/#findComment-440175 Share on other sites More sharing options...
blackcell Posted January 16, 2008 Author Share Posted January 16, 2008 I think I got it from here. Thanks fenway. Quote Link to comment https://forums.phpfreaks.com/topic/85563-solved-mysql-export-statement/#findComment-440853 Share on other sites More sharing options...
blackcell Posted January 16, 2008 Author Share Posted January 16, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/85563-solved-mysql-export-statement/#findComment-440870 Share on other sites More sharing options...
fenway Posted January 17, 2008 Share Posted January 17, 2008 DUMPFILE? shouldn't it be OUTFILE? Quote Link to comment https://forums.phpfreaks.com/topic/85563-solved-mysql-export-statement/#findComment-441466 Share on other sites More sharing options...
blackcell Posted January 17, 2008 Author Share Posted January 17, 2008 From my reading, I think that there are two options (DUMPFILE and OUTFILE) that act similar with the exception that one has a slightly different way of acting with more paramaters. Quote Link to comment https://forums.phpfreaks.com/topic/85563-solved-mysql-export-statement/#findComment-441802 Share on other sites More sharing options...
fenway Posted January 17, 2008 Share Posted January 17, 2008 Then it might be a file path issue, don't think I've ever used it with UNC paths... did you try something local? Quote Link to comment https://forums.phpfreaks.com/topic/85563-solved-mysql-export-statement/#findComment-441852 Share on other sites More sharing options...
beebum Posted January 18, 2008 Share Posted January 18, 2008 Limit needs to come before Into. Quote Link to comment https://forums.phpfreaks.com/topic/85563-solved-mysql-export-statement/#findComment-442719 Share on other sites More sharing options...
blackcell Posted February 9, 2008 Author Share Posted February 9, 2008 I found a method of backing up the table(s) via hard sql files located in the mysql directory. I don't know if that can cause issues later on or how unstable it is. Seems to work and retain information, although the files are slightly bigger than expected. Quote Link to comment https://forums.phpfreaks.com/topic/85563-solved-mysql-export-statement/#findComment-462644 Share on other sites More sharing options...
fenway Posted February 9, 2008 Share Posted February 9, 2008 Works for MyISAM... but make sure the tables aren't being accessed. Quote Link to comment https://forums.phpfreaks.com/topic/85563-solved-mysql-export-statement/#findComment-462806 Share on other sites More sharing options...
blackcell Posted February 10, 2008 Author Share Posted February 10, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/85563-solved-mysql-export-statement/#findComment-462968 Share on other sites More sharing options...
fenway Posted February 19, 2008 Share Posted February 19, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/85563-solved-mysql-export-statement/#findComment-470657 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.