简体   繁体   中英

Ant build failed for mysql

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM