BigD Posted January 28, 2012 Share Posted January 28, 2012 "Is there a way to submit create table query from a file to MySQL? I want to keep records of how my tables are created and later on be able to repeat creating them on a different PC." Link to comment Share on other sites More sharing options...
birbal Posted January 28, 2012 Share Posted January 28, 2012 You can use any query from a php file to get executed. But genraly tables an database are disgned before and dont create that dynamicaly Link to comment Share on other sites More sharing options...
BigD Posted January 28, 2012 Author Share Posted January 28, 2012 I am at the beginning phase of a project, creating tables in my database. The tables are related, I have to submit create table with foreign keys to MySQL console. Instead of typeing these command, I want to keep these commands in a file and submit that file to MySQL console. Can that be done? Link to comment Share on other sites More sharing options...
birbal Posted January 28, 2012 Share Posted January 28, 2012 you can use phpmyadmin for this instead of console. search for it in google. one you create the table you can get back the queries from there Link to comment Share on other sites More sharing options...
sonu Posted January 30, 2012 Share Posted January 30, 2012 You can find more information & examples @ here Foreign Key Hope it will help you! Link to comment Share on other sites More sharing options...
BigD Posted January 30, 2012 Author Share Posted January 30, 2012 Thanks for all the posts.I think phpmyadmin can only create tables that are not releated. For related tables I have to use MySQL console to specify how tables are related with Foreign Keys.My question is not on how to use Foreign keys, it is "instead type in Create Table.... query on MySQL console each time, can I save the query in a file and submit the file to MySQL console?" Link to comment Share on other sites More sharing options...
justsomeguy Posted January 30, 2012 Share Posted January 30, 2012 http://dev.mysql.com...h-commands.html Any file you use via the command line can also be uploaded through phpMyAdmin. Link to comment Share on other sites More sharing options...
BigD Posted February 4, 2012 Author Share Posted February 4, 2012 Thanks Justsomeguy, Is the link you provided for Unix OS? I tried on Windows OS and could not get it to work.I can copy and paste my file with SQL statements to MySQL console and execute it, I was hoping there is a better way. Link to comment Share on other sites More sharing options...
justsomeguy Posted February 5, 2012 Share Posted February 5, 2012 I don't see any notes or anything on that page concerning different syntax for Windows. I'm not sure if the < operator would be different. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.