Question: I was wondering whether the following command (from a .bat script):

(1) connects to the mysql instance once and then executes script#1 followed by script#2, or (2) does it reconnect for each of the sql scripts?

```
mysql -B -b -h%HOST% -u%USER% -p%PASSWORD% %SCHEMA% < "scripts\create_and_populate.sql" < "scripts\update_joomla_article.sql"

```

I have a bad feeling it reconnects. If so, how would I go about changing the .bat script to execute one sql script after another without reconnecting. Cheers :)

---

**Edit:**

I only found out recently, to my great shame :-Z, that this command does not actually work as I expected.

`mysql ... < script1 < script2 < script3` appeared to work at first, until I spotted that only the *last* script in the chain is actually executed. Still, I will welcome any suggestions as to How to get this done in a different way that what Colin Pickard suggested.

Answer: 
You could maybe use a couple of scripts with [`SELECT CONNECTION_ID( );`](http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_connection-id) to determine your theory, and then something like this:

```
copy scripts\create_and_populate.sql+scripts\update_joomla_article.sql scripts\temp\create_update.sql
mysql -B -b -h%HOST% -u%USER% -p%PASSWORD% %SCHEMA% < "scripts\temp\create_update.sql"
del scripts\temp\create_update.sql

```

(WARNING: I have not tested that! try it out first!)
one more suggestion, does this work?

```
mysql -e script1 -e script2 -e script3

```