Jump to content

How to submit queries from a file to MySQL?


BigD

Recommended Posts

"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."cleardot.gif

Link to comment
Share on other sites

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

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

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...