Page 1 of 1
Executing SQL queries from the DOS prompt
Posted: Wed May 19, 2004 12:25 pm
by Sniper007
Please, be gentle on me. I'm spoiled by phpMyAdmin. I've never had to run a command from the DOS prompt before... I am wondering how / if there is a way to run SQL commands and queries from the DOS prompt in WinXP. Specifically, a LOAD DATA INFILE command. What exactly is the syntax, for a command like that at the command prompt? I know it can't just be, "LOAD DATA INFILE... " That would never work... Is there some SQL.exe or something?
Posted: Wed May 19, 2004 12:35 pm
by timvw
there is a mysqlclient (called mysql.exe in the mysql/bin directory) which you can use for that.
It might be usefull to add that directory to your path (here you can see how to do that
http://home.mysth.be/~timvw/articles/in ... 2sdk-winxp, it's similar for mysql)
mysql -u username -p < statements.sql is magic
[/url]
Posted: Wed May 19, 2004 12:37 pm
by lostboy
actually it is about that simple (see
here)..All you need to so is start the console on mysql
nvaigate to the mysql\bin dir and type
mysqld then follow th example in the manual
Alternate Solution
Posted: Fri May 21, 2004 11:30 pm
by Sniper007
Thanks, but I think I'm going to execute lines off of php.exe using CLI... Then just use whatever .php files I want that contain the SQL commands.
Code: Select all
C:\swamp\php\cli\php.exe -f C:\swamp\www\myphp.php