Batch file issue
Posted by: B W
Date: December 04, 2013 11:00AM

My goal is to get a simple batch file to run automatically on a Windows 7 Professional SP1 server with MariaDB 5.5.

The FILE is SQL_e.bat :

echo %userdomain%\%username%
pause
mysql -u user-ppassword -D DBname -e "source C:\tmp\test.sql"
pause

The test.sql is a simple create table:

CREATE TABLE `test` (
`DateTime` DATETIME NOT NULL,
`Part` VARCHAR(20) NULL DEFAULT NULL,

PRIMARY KEY (`DateTime`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB;

opening cmd.exe with promt C:\Users\user and entering:

mysql -u user-ppassword -D DBname -e "source C:\tmp\test.sql"

WORKS

executing the SQL_e.bat gives the message

'mysql' not recognized command.

If I add the path in SQL_e.bat with

cd C:\Program Files\MariaDB 5.5\bin

I get

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' <10061>

The C:\tmp\test.sq is local on the server. The user has HOST % and Allow access to ALL Global privileges.
I have no set path used. I added the cmd echo %userdomain%\%username%. Both the cmd and batch show the same domain & user. There is almost nothing changed in any MySQL ini or cnf file. I am at a loss what to look at to find the discrepancy?



Edited 1 time(s). Last edit at 12/18/2013 08:55AM by B W.

Options: ReplyQuote


Subject
Views
Written By
Posted
Batch file issue
2954
B W
December 04, 2013 11:00AM
903
B W
January 03, 2014 09:21AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.