[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 179
  • Last Modified:

Executing a .sql file with CMD

Hi Experts,

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

Thank you
0
APD Toronto
Asked:
APD Toronto
  • 2
1 Solution
 
Seth SimmonsSr. Systems AdministratorCommented:
mysql < myscript.sql

of course, add other parameters in the beginning if you need to supply username/password, etc.
0
 
Mohammed KhawajaManager - Infrastructure:  Information TechnologyCommented:
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
 
APD TorontoAuthor Commented:
You can access remote machines too?
0
 
Seth SimmonsSr. Systems AdministratorCommented:
yes assuming the user account is granted access from a specific machine or % for any machine; used with grant statement
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now