
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How can we run MySQL statements in batch mode?
We need to create a .sql file for running MySQL in batch mode. This file will contain the MySQL statements. Suppose I have hh.sql file in which I have written the statement select * from hh. With the help of the following command, we can run this file in batch mode −
Example
C:\Program Files\MySQL\bin>mysql -u root -p gaurav < hh.sql Enter password: *****
Output
id 1 2
Here Gaurav is the database name that contains the table hh. Whenever you’ll run this command it will ask for the password and then give the output.
- Related Articles
- While running MySQL statements in batch mode, how can we print, along with output, which statements are getting executed?
- Using MySQL in Batch Mode
- How can we use prepared statements in MySQL?
- How can we force MySQL out of TRADITIONAL mode?
- How to get the MySQL interactive output format in batch mode also?
- How can we run a MySQL statement without termination semicolon?
- How can we find out the current transaction mode in MySQL?
- How can we run Matplotlib in Tkinter?
- How can Tensorflow be used to run the classifier on a batch of images?
- Batch Inserts Using JDBC Statements
- Can we use a comma between MySQL SELECT statements?
- Batch Inserts Using JDBC Prepared Statements
- How to Run WebDriver in Headless Mode using Postman?
- Can we synchronize a run() method in Java?
- How to batch update MySQL table?

Advertisements