How to execute a mysql script from a batch file, using a properties file to read the username and password -
i have batch file executes mysql scripit (test.sql) im passing user name , pasword batch, dont want to, instead want read username/ password properties file or text file. please can 1 help. below sample batch , sql file.
sample batch file :
@echo off echo starting batch job cd c:\program files\mysql\mysql server 5.6\bin mysql --user=root --password=mysql123 --database=mydb -e "source c:\shstemp\sqlscripts\test.sql" echo after executing sql pause this sample sql script
use mydb; select * test_table;
mysql has back upwards client-side config files, see manual here: http://dev.mysql.com/doc/refman/5.1/en/option-files.html
they my.cnf files , can set username , password in there.
example:
[client] user="user" password="my_password" mysql batch-file
No comments:
Post a Comment