如何使用Ant任务来启动MySQL [英] How to start MySql using ANT task

查看:346
本文介绍了如何使用Ant任务来启动MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要开始使用Ant任务停止的MySQL 5.5。

I need to start and stop mysql 5.5 using ant task.

早期的ANT脚本是这样做,以供其使用的类是像org.hsqldb.Server HSQLDB数据库。有人能告诉我使用的MySQL 5.5哪一类。

The earlier ANT script was doing it for hsqldb database for which the class it was using was org.hsqldb.Server. Could someone tell me which class to use for mysql 5.5.

以下是正在为HSQLDB mydb的情况下使用:
        < java的叉=真正的重生=真正的类名=像org.hsqldb.Serverclasspathref =build.runtime.classpath>
            < ARG行= - log中的数据/ MYDB -dbname.0 MYDB/>
        < / JAVA>

Following was being use in case of hsqldb for mydb: <java fork="true" spawn="true" classname="org.hsqldb.Server" classpathref="build.runtime.classpath"> <arg line="-database.0 file:data/mydb -dbname.0 mydb"/> </java>

我需要为MySQL 5.5 eqivalant。我知道一个连接器用于连接到MySQL数据库5.5,我用使用mysql-connector-java的5.1.15-bin.jar

I need to have the eqivalant for mysql 5.5. I know a connector is used to connect to mysql 5.5 database, I use mysql-connector-java-5.1.15-bin.jar.

有人能告诉我如何启动和使用Ant脚本停止MySQL数据库。

Could someone just tell me how to start and stop mysql database using an ant script.

感谢。

推荐答案

这将是比较正常的MySQL的配置的自动启动机器启动的时候。 MySQL的被设计为在后台不断地运行。

It would be more normal to configure MySQL to automatically start when the machine boots. MySQL is designed to run continually in the background.

如果你真的想停下来,启动MySQL从ANT内有可能调用(MySQL的是在同一台机器上运行作为构建假设当然)的服务器脚本。

If you really want to stop and start MySQL from within ANT it's possible to invoke the server scripts (Assuming of course MySQL is running on the same machine as the build).

<target name="start-db">
  <exec executable="C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" osfamily="windows">
  </exec>

  <exec executable="mysql.server" osfamily="unix">
    <arg value="start"/>
  </exec>
</target>

<target name="stop-db">
  <exec executable="C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" osfamily="windows">
    <arg value="-u"/>
    <arg value="root"/>
    <arg value="shutdown"/>
  </exec>

  <exec executable="mysql.server" osfamily="unix">
    <arg value="stop"/>
  </exec>
</target>

注意:

  • This script contains commands to start/stop on both windows and unix.
  • The MySQL documentation describes how to start Mysql from the windows command line

这篇关于如何使用Ant任务来启动MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆