MySQL Shell 8.0
Once a sandbox instance is running, it is possible to change its status at any time using the following commands. Specify the port number for the instance to identify it:
To stop a sandbox instance using JavaScript, issue
dba.stopSandboxInstance(
.
This stops the instance gracefully, unlike
instance
)dba.killSandboxInstance(
.
instance
)
To stop a sandbox instance using Python, issue:
dba.stop_sandbox_instance(
.
This stops the instance gracefully, unlike
instance
)dba.kill_sandbox_instance(
.
instance
)
To start a sandbox instance using JavaScript, issue:
dba.startSandboxInstance(
.
instance
)
To start a sandbox instance using Python, issue:
dba.start_sandbox_instance(
.
instance
)
To kill a sandbox instance using JavaScript, issue:
dba.killSandboxInstance(
.
This stops the instance without gracefully stopping it and
is useful in simulating unexpected halts.
instance
)
To kill a sandbox instance using Python, issue:
dba.kill_sandbox_instance(
.
This stops the instance without gracefully stopping it and
is useful in simulating unexpected halts.
instance
)
To delete a sandbox instance using JavaScript, issue:
dba.deleteSandboxInstance(
.
This completely removes the sandbox instance from your file
system.
instance
)
To delete a sandbox instance using Python, issue:
dba.delete_SandboxInstance(
.
This completely removes the sandbox instance from your file
system.
instance
)
Sandbox instances are considered to be transient and are not
designed for production use. They are therefore not supported
for version upgrades. In a sandbox deployment, each sandbox
instance uses a copy of the mysqld binary
found in the $PATH
in the local
mysql-sandboxes
directory. If the version of
mysqld changes, for example after an upgrade,
sandboxes based on the previous version fail to start. This is
because the sandbox binary is outdated compared to the
dependencies found under the
basedir
.
If you do want to retain a sandbox instance after an upgrade, a
workaround is to manually copy the upgraded
mysqld binary into the
bin
directory of each sandbox. Then start
the sandbox by issuing
dba.startSandboxInstance()
. The operation
fails with a timeout, and the error log contains:
2020-03-26T11:43:12.969131Z 5 [System] [MY-013381] [Server] Server upgrade from '80019' to '80020' started. 2020-03-26T11:44:03.543082Z 5 [System] [MY-013381] [Server] Server upgrade from '80019' to '80020' completed.
Although the operation seems to fail with a timeout, the sandbox has started successfully.