Home >> FAQs/Tutorials >> MySQL Tutorials

MySQL Tutorial - Running "mysql" Commands from a Batch File

By: FYIcenter.com

(Continued from previous topic...)

How To Run "mysql" Commands from a Batch File?

If you have group of "mysql" commands that need to be executed repeatedly, you can put them into a file, and run them from the file in "mysql" batch mode. Here is a batch file, \temp\links.sql, contains following commands:

USE test;
INSERT INTO links VALUES (10, 'dba.fyicenter.com');
SELECT * FROM links;

To run this batch file, you need to follow this tutorial:

>cd \mysql\bin
>mysql -u root < \temp\links.sql
id      name
1       dba.fyicenter.com
10      dba.fyicenter.com

(Continued on next topic...)

  1. What Is the Command Line End User Interface - mysql?
  2. What Are the "mysql" Command Line Options?
  3. What Are the "mysql" Command Line Arguments?
  4. How Many SQL DDL Commands Are Supported by "mysql"?
  5. How Many SQL DML Commands Are Supported by "mysql"?
  6. What Are the Non-Standard SQL Commands Supported by "mysql"?
  7. How To Get Help Information from the Server?
  8. How To Run "mysql" Commands from a Batch File?
  9. How To Return Query Output in HTML Format?
  10. How To Return Query Output in XML Format?

MySQL Tutorials:

More...


Other Tutorials/FAQs:

More...


Related Resources:

More...


Selected Jobs:

More...