Link to home
Start Free TrialLog in
Avatar of APD Toronto
APD TorontoFlag for Canada

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Seth Simmons
Seth Simmons
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Avatar of APD Toronto

ASKER

You can access remote machines too?
yes assuming the user account is granted access from a specific machine or % for any machine; used with grant statement