Ant build failed for mysql

2019-08-05 10:42发布

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条回答
别忘想泡老子
2楼-- · 2019-08-05 11:16

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.

查看更多
登录 后发表回答