If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > is any way execute these statements at once localhost?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-19-10, 08:34
lse123 lse123 is offline
Registered User
 
Join Date: May 2007
Posts: 139
is any way execute these statements at once localhost?

I have a textbook in java/db:mysql/jsp that in code files have in databases chapter a file webhomecoverdb.ddl, with sql statements modify db/tables, wueries, update queries, organized one line each statement, well is any way execute these statements at once in localhost(jsp/mysql/windows)?
Reply With Quote
  #2 (permalink)  
Old 04-19-10, 08:52
Ikviens Ikviens is offline
Registered User
 
Join Date: Mar 2006
Posts: 55
Hi, lse.

You can write all your SQL statements in a text file and feed the file to MySQL in a few ways:
MySQL :: MySQL 5.1 Reference Manual :: 4.5.1.4 Executing SQL Statements from a Text File
Reply With Quote
  #3 (permalink)  
Old 04-22-10, 02:50
lse123 lse123 is offline
Registered User
 
Join Date: May 2007
Posts: 139
this mean the file must be text, but file extension does not matter?

this mean the file must be text, but file extension does not matter?
Reply With Quote
  #4 (permalink)  
Old 04-22-10, 05:34
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 620
There are two ways of executing a file containing either passing in the file name at the command line:

mysql < filename

or if you are already in mysql using

source filename

the filename can have any type of extension but having a standard naming convention for your files helps later on understand what the file actually is used for. The typical standard is .sql
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On