问题
When I run Ant build using mysql the following error occur
Cannot run program "mysql" (in directory
"D:\Projects\OBSWorkspace\schoolforms\db"):
CreateProcess error=2, The system cannot find the file specified
when i run mysql in local cmd the following message occur
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password:
NO)
how to run ant for generating and creating database from the script.
回答1:
First of all you need to try to connect with mysql via cmd line, for example int this way mysql -u root -p root
to know that you are able to do it. Secondly you can do it from ant build using this code:
<project name="mysql.test" default="mysqltest">
<target name="mysqltest">
<exec executable="cmd.exe">
<arg value="mysql" />
<arg value="-u root" />
<arg value="-p root" />
</exec>
</target>
</project>
You probably try to do it not via cmd
and thats why you can't connect.
来源:https://stackoverflow.com/questions/15835076/ant-build-failed-for-mysql