Bug #102623 AdminAPI MySQL Sandboxes is wrong about PATH envirinment variable
Submitted: 17 Feb 2021 14:36 Modified: 11 Mar 2021 12:33
Reporter: Tsubasa Tanaka (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[17 Feb 2021 14:36] Tsubasa Tanaka
Description:
Document describes,

> When you deploy sandboxes, MySQL Shell searches for the mysqld binary which it then uses to create the sandbox instance. You can configure where MySQL Shell searches for the mysqld binary by configuring the PATH environment variable. This can be useful to test a new version of MySQL locally before deploying it to production. For example, to use a mysqld binary at the path /home/user/mysql-latest/bin/mysqld issue:
> PATH=/home/user/mysql-latest/bin/mysqld:$PATH

But actually, MySQL Shell searches "Under in $PATH directories", example should be

> PATH=/home/user/mysql-latest/bin:$PATH

MySQL :: MySQL Shell 8.0 :: 6.5 AdminAPI MySQL Sandboxes https://dev.mysql.com/doc/mysql-shell/8.0/en/admin-api-sandboxes.html

How to repeat:
My MySQL 8.0.23 is /usr/mysql/8.0.23/bin/mysqld.

$ ll /usr/mysql/8.0.23/bin/mysqld
-rwxr-xr-x 1 yoku0825 yoku0825 1194848048 Jan 19 16:18 /usr/mysql/8.0.23/bin/mysqld

Set PATH environment variable as document describes.

$ PATH=/usr/mysql/8.0.23/bin/mysqld:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
$ echo $PATH
/usr/mysql/8.0.23/bin/mysqld:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin

Run dba.deploySandboxInstance.

$ mysqlsh
 MySQL  JS > dba.deploySandboxInstance(3307)
..
Dba.deploySandboxInstance: ERROR: Error creating sandbox: Could not find mysqld executable. Make sure it is on the $PATH environment variable. (RuntimeError)

Correctly, PATH should not be include filename.

$ PATH=/usr/mysql/8.0.23/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
$ echo $PATH
/usr/mysql/8.0.23/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin

I can start Sandbox Instance.

$ mysqlsh
 MySQL  JS > dba.deploySandboxInstance(3307)
..
Instance localhost:3307 successfully deployed and started.

Suggested fix:
Fix example in the document.

MySQL :: MySQL Shell 8.0 :: 6.5 AdminAPI MySQL Sandboxes https://dev.mysql.com/doc/mysql-shell/8.0/en/admin-api-sandboxes.html
[17 Feb 2021 15:13] MySQL Verification Team
Hi Mr. tanaka,

Thank you for your bug report.

We agree with your diagnosis.

Verified as reported.
[11 Mar 2021 12:33] David Moss
Thank you for your feedback, this has been fixed in the docs:

https://dev.mysql.com/doc/mysql-shell/8.0/en/admin-api-sandboxes.html
[11 Mar 2021 13:42] MySQL Verification Team
Thank you, David .........