Solved

Executing a .sql file with CMD

Posted on 2014-10-17
4
163 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Comma and period key both show comma symbol. 1 29
Upgrade Windows 7 pro to Enterprise 8 76
How to fix Datetime in MySQL? 4 47
Where on a calculated field 1 20
Creating and Managing Databases with phpMyAdmin in cPanel.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo‚Ķ
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.

792 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