Executing SQL queries from the DOS prompt
Moderator: General Moderators
Executing SQL queries from the DOS prompt
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?
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]
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]
Alternate Solution
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