I have created a batch script which is supposed to execute the SQL file in the same directory and then pause, where I connect to MYSQL and issue the commands inside of the SQL file. For some reason when I directly paste these lines into a command window, it works fine. When I have it setup as follows, I receive an Access Denied error. Can anyone please point out what I am doing wrong?
BAT File:
cmd < script.sql
pause
Script.SQL file
@echo off
mysql --host=localhost --user=dbuser --password=dbpassword --database=dbname
SELECT `SERVER_ID`
FROM tc_services
WHERE `GAME_ID` LIKE '%TC510254610%'
INTO OUTFILE 'D:\\Program Files (x86)\\TCAdmin Control Panel\\ScheduledTasks\\GAME\\ServerID.txt'
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\r\n';
exit