Solved

Executing a .sql file with CMD

Posted on 2014-10-17
4
160 Views
Last Modified: 2014-10-17
Hi Experts,

I'm running MySQL on Win7, and I cannot remember, how can I execute myscript.sql from cmd?

Thank you
0
Comment
Question by:APD_Toronto
  • 2
4 Comments
 
LVL 34

Accepted Solution

by:
Seth Simmons earned 500 total points
ID: 40387317
mysql < myscript.sql

of course, add other parameters in the beginning if you need to supply username/password, etc.
0
 
LVL 25

Expert Comment

by:Mohammed Khawaja
ID: 40387333
Below is the syntax to use:

mysql --host=servernane --user=username --password=password database_name < pathTofilename.sql
i.e. mysql -host=jupiter.localdomain.local -user=john.doe -password=IdontKnow salesDB < myscript.sql
0
 

Author Comment

by:APD_Toronto
ID: 40387341
You can access remote machines too?
0
 
LVL 34

Expert Comment

by:Seth Simmons
ID: 40387362
yes assuming the user account is granted access from a specific machine or % for any machine; used with grant statement
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to install Windows Server tools on Windows 7 Enterprise. 9 47
paypal ipn to mysql 3 35
Selecting Operating System at boot screen 4 61
WMIC Command LIne 5 26
OfficeMate Freezes on login or does not load after login credentials are input.
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

775 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question