Ant build failed for mysql

孤街浪徒 提交于 2019-12-11 04:38:58

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!