You can use the -e or --execute option to a statement directly from the command line. Take an example, you want to see all user data from user table of mysql database. My MySQL username and password is root:
C:\AppServ\MySQL>mysql --user=root --password=root mysql -e "SELECT * FROM user";
Comments
Submitted by UYDSBHBQ on Thursday, 13th November 2008 at 14:23:57