Jump to content

How to submit queries from a file to MySQL?


BigD
 Share

Recommended Posts

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

Edited by birbal
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...