Executing SQL Statements from a Text File
The mysql client typically is used interactively, like this:
debian1:~# mysql db_name
However, it is also possible to put your SQL statements in a file and then tell mysql to read its input from that file. To do so, create a text file text_file that contains the statements you wish to execute. Then invoke mysql as shown here:
debian1:~# mysql db_name < text_file
If you place a USE db_name statement as the first statement in the file, it is unnecessary to specify the database name on the command line:
debian1:~# mysql < text_file
From the MySQL Manual
Related posts:
- Howto: How to Reset the MySQL Root Password
- MDB Tools to export (migrate) from mdb (Microsoft Access format) to MySQL
- Howto Convert Text File From UTF-8 to ISO-8859-1 Encoding
- Bash shortcuts tips and tricks
- Sun acquires MySQL
- Optimize MySQL for Low Memory Use
- Sending Spam with SWT
- Slow Query Log Analyzes Tools
- Troubleshooting PHP Sqlite Query Error: Unable to open database
- Combine Multiple PDFs Into One File
Popular Related Items »
Incoming search terms
- Executing SQL Statements from a Text File
- mysql execute sql file
- mysql run external sql file
- java execute sql file
- mysql run sql file
- mysql external sql file
- ubuntu run sql script
- run sql script ubuntu
- java read sql file
- java run sql file
- how to execute sql file in mysql
- ubuntu execute sql
- ubuntu run sql file
- run sql file ubuntu
- execute sql file java
- Execute SQL FILE from Java
- mysql execute external file
- ubuntu mysql run sql file
- mysql load external sql file
- execute sql from file
- sql file java
- read sql file java
- mysql running sql file
- how to execute sql file in windows
- execute sql text
- execute sql from text file
- run sql file in ubuntu
- ubuntu execute sql file
- execute sql file ubuntu
- execute sql file
- execute sql file from terminal
- execute sql file in java
- ubuntu execute sql script
- run sql script in ubuntu
- MYSQL EXECUTE SQL FROM FILE
- ubuntu sql script
- place your sql statement in a text file
- executing sql file in java
- linux execute sql file
- run sql file in linux
- mysql run sql file ubuntu
- run sql file in terminal
- mysql terminal run sql
- execute sql script ubuntu
- execute sql file php
