类 ServerController
- java.lang.Object
-
- com.mysql.cj.admin.ServerController
-
public class ServerController extends Object
Controls a MySQL server using Java RunTime methods
-
-
字段概要
字段 修饰符和类型 字段 说明 static StringBASEDIR_KEYWhere is the server installed?static StringDATADIR_KEYWhere are the databases installed?static StringDEFAULTS_FILE_KEYWhere is the config file located?static StringEXECUTABLE_NAME_KEYWhat is the name of the executable to run?static StringEXECUTABLE_PATH_KEYWhat is the path to the mysql server executable (if not standard?)
-
构造器概要
构造器 构造器 说明 ServerController(String baseDir)Creates a ServerController with the directory for the MySQL server.ServerController(String basedir, String datadir)Creates a server controller for the MySQL server with the given basedir and datadir.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidforceStop()Forcefully terminates the server process (if started).PropertiesgetServerProps()Returns the list of properties that will be used to start/control the server.voidsetBaseDir(String baseDir)Sets the basedir to use when starting MySQL.voidsetDataDir(String dataDir)Sets the data to use when starting MySQL.Processstart()Starts the server, returning a java.lang.Process instance that represents the mysql server.voidstop(boolean forceIfNecessary)Stops the server (if started)
-
-
-
构造器详细资料
-
ServerController
public ServerController(String baseDir)
Creates a ServerController with the directory for the MySQL server. The 'datadir' is set to the same directory.- 参数:
baseDir- the base directory for the MySQL server.
-
-
方法详细资料
-
setBaseDir
public void setBaseDir(String baseDir)
Sets the basedir to use when starting MySQL.- 参数:
baseDir- the basedir to use when starting MySQL.
-
setDataDir
public void setDataDir(String dataDir)
Sets the data to use when starting MySQL.- 参数:
dataDir- the basedir to use when starting MySQL.
-
start
public Process start() throws IOException
Starts the server, returning a java.lang.Process instance that represents the mysql server.- 返回:
- Process a java.lang.Process instance representing the mysql server process.
- 抛出:
IOException- if an error occurs while starting the mysql server.
-
stop
public void stop(boolean forceIfNecessary) throws IOExceptionStops the server (if started)- 参数:
forceIfNecessary- use forceStop if mysqladmin doesn't shut the server down- 抛出:
IOException- if an error occurs while stopping the server
-
forceStop
public void forceStop()
Forcefully terminates the server process (if started).
-
getServerProps
public Properties getServerProps()
Returns the list of properties that will be used to start/control the server.- 返回:
- Properties the list of properties.
-
-