views:

19

answers:

1

One of my clients has an issue with his MySQL database. To solve the issue I need to just run a simple update on a table. I will need to send that to my client via a batch file.

How do I run a MySQL update on a table via a batch file?

A: 

Typically I put the SQL commands that I want to use in a plain text file. You can then call the file by launching mysql and:

\. filename

This will run each line of the file as if it was typed from input. It is also easy to test.

If you need more, you can launch mysql via a command they can cut and paste and pipe the file into mysql as the input. Make sure usernames and passwords are handled by your command line or your script.

Cheers, Jacob

TheJacobTaylor
Or excecute the command file from the prompt `mysql> SOURCE myfile.sql;`
Brian Hooper