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
- Howto Convert Text File From UTF-8 to ISO-8859-1 Encoding
- MDB Tools to export (migrate) from mdb (Microsoft Access format) to MySQL
- Bash shortcuts tips and tricks
- Sun acquires MySQL
- Sending Spam with SWT
- Optimize MySQL for Low Memory Use
- Troubleshooting PHP Sqlite Query Error: Unable to open database
- Slow Query Log Analyzes Tools
- dos2unix on Ubuntu and Debian
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
- ubuntu run sql script
- mysql run sql file
- run sql script ubuntu
- mysql external sql file
- java read sql file
- how to execute sql file in mysql
- java run sql file
- ubuntu run sql file
- execute sql from file
- ubuntu execute sql
- mysql running sql file
- execute sql file java
- run sql file ubuntu
- sql file java
- execute sql text
- ubuntu mysql run sql file
- Execute SQL FILE from Java
- execute sql from text file
- mysql execute external file
- how to execute sql file in windows
- mysql load external sql file
- MYSQL EXECUTE SQL FROM FILE
- run sql file in ubuntu
- execute sql file from terminal
- ubuntu execute sql script
- execute sql script ubuntu
- linux execute sql file
- how to execute text file in sql
- read sql file java
- ubuntu execute sql file
- place your sql statement in a text file
- execute sql file php
- execute sql file in mysql
- debian run sql script
- execute sql file in java
- how to run sql script ubuntu
- run sql file in linux
- executing sql file in java
- sql file ubuntu
- run sql file in terminal
- how to execute sql file
