Monday 16 January 2012

Mysql source

Executing number of sql queries at a time using "source" command

Make all the queries in a single file, here i opened a file called "ctechz.sql" and saved all sql queries in this file.

# mysql -uroot -pmysql
mysql> use dbname;  ----- be in that database
and then run the "source"  command to update the queries into the tables.
mysql> source ctechz.sql

it will execute all sql queries in the file ctechz.sql at the same time. When you are using the #mysql command to log into the db make sure that you are doing this from the direcory where you placed the ctechz.sql file.

You will see quite a bit of output as mysql reads queries from the ctechz.sql file and executes them.





No comments:

Post a Comment