Creating a .bat file to execute mysql and other commands

Posted by BCIT - JD on Super User See other posts from Super User or by BCIT - JD
Published on 2012-11-21T01:22:54Z Indexed on 2012/11/22 5:03 UTC
Read the original article Hit count: 477

Filed under:
|

I'm looking for a way to reduce the amount of typing I do to check mysql entries and other things. For example, I wanted to create a .bat file that will execute the following commands.

mysql -u user -p
*enter in the password*
USE databasename
SELCT * FROM table;

The problem is after the initial mysql -u user -p the rest of the commands written down do not get executed. Is it possible to continue running commands after calling something like mysql or other programs, that seem to add its prefix(?) to the beginning of commands (mysql>). I'm not very familiar with the terminology so forgive me if it sounds confusing. I'd like to use the same kind of concept for other things as well.

Help is much appreciated, Thanks.

© Super User or respective owner

Related posts about mysql

Related posts about batch-file