I've been asked about porting the MySQL shell. https://dev.mysql.com/doc/mysql-shell/8.0/en/mysql-shell-install.html I'm opening this ticket in case anyone has already done work on this. I heard it was once in the ports tree, and is no longer. Adding joneum@ to this in case they've considered this work.
^Triage: the better way to have done this is to put an entry into the wiki under WantedPorts. Without a patch it is unlikely anything will happen.
(In reply to Mark Linimon from comment #1) Valid points. Given I was asked to do the work, this was my reaching out publicly to the MAINTAINER before beginning, just in case the work had been done, abandoned, etc, before I started in. I'm hoping that any "No, don't do that because..." messages can arrive before I being work on it. :)
(In reply to Dan Langille from comment #2) Hello, The port sounds interesting. I'd be happy to take a look at it. Or you can create the port—whatever you prefer, Dan :-)
(In reply to Jochen Neumeister from comment #3) Please proceed. I didn't want to down this track for fear it would consume far more time than expected. Thank you.
I'm also interested to help with this port. Some info for how to build MySQL Shell: https://github.com/mysql/mysql-shell/blob/master/INSTALL Note that there are a few things that make building mysql-shell a bit more complicated: 1. It needs a build of MySQL for libmysqlclient and libxmysqlclient. I hope we can use the existing mysql port for this, but I'm not sure about this. 2. It builds with Python. I guess this should be strait forward. 3. It builds with javascript support via Graal / Polyglog API. Details in the INSTALL file and here: https://github.com/mysql/mysql-shell/blob/master/ext/polyglot/README.txt I think it would be good to first try and build without Javascript or Python and then first add Python and later add Javascript.
I managed to build MySQL Shell on FreeBSD 15. This isn't a port yet, but it is a step in the right direction. % ./bin/mysqlsh --version ./bin/mysqlsh Ver 9.6.0 for FreeBSD15.0 on amd64 - for MySQL 9.6.0 (Source distribution) Here are my notes: # Sources - https://dev.mysql.com/get/Downloads/MySQL-9.6/mysql-9.6.0.tar.gz - https://dev.mysql.com/get/Downloads/MySQL-Shell/mysql-shell-9.6.0-src.tar.gz # MySQL ## Dependencies Packages: - cmake - bison - pkgconf - protobuf ## Building ``` tar zxf mysql-9.6.0.tar.gz cd mysql-9.6.0 mkdir bld cd bld cmake .. -DWITH_SSL=system -D CMAKE_INSTALL_PREFIX=/home/dveeden/mysql-shell/mysql make -j18 install ``` - The INSTALL file says only building the mysqlclient and mysqlxclient targets is enough. This isn't the case - You also need to build the libprotobuf-lite target - You do need to install as scripts/mysql_config output is used to find things - Building with `-DWITHOUT_SERVER=ON -DWITH_UNIT_TESTS=OFF` doesn't provide the right libraries - You need to add `#include <sys/stat.h>` to `sql/server_component/mysql_file_imp.cc` # MySQL Shell ## Dependencies - MySQL build from source (not a package) - cmake - libantlr4 - libssh (not libssh2) ## Building ``` tar zxf mysql-shell-9.6.0-src.tar.gz cd mysql-shell-9.6.0-src mkdir bld cd bld cmake .. -DMYSQL_SOURCE_DIR=/home/dveeden/mysql-shell/mysql-9.6.0 -DMYSQL_BUILD_DIR=/home/dveeden/mysql-shell/mysql-9.6.0/bld -DBUNDLED_ANTLR_DIR=/usr/local ``` - mysqlshdk/libs/utils/logger.cc: Add include for sys/stat.h - mysqlshdk/libs/utils/utils_file.cc: Change linux/limits.h to limits.h - mysqlshdk/libs/utils/utils_file.cc: Change stat64 to stat on line 415, 416 - mysqlshdk/libs/ssh/ssh_tunnel_handler.cc: Add incluedes for sys/types.h, sys/socket.h and netinet/in.h - mysqlshdk/libs/utils/utils_general.cc: Change the code around line 251 so it takes the other version - mysqlshdk/libs/utils/utils_general.cc: Add elif for __FreeBSD__ - mysqlshdk/libs/utils/utils_general.cc: Add include for sys/wait.h - mysqlshdk/libs/utils/utils_general.h: Add FREEBSD to OperatingSystem - mysqlshdk/libs/utils/utils_net.cc: Add netinet/in.h include - mysqlshdk/libs/utils/utils_os.cc: Remove sysinfo stuff, make it go to return 0 - mysqlshdk/libs/utils/uuid_gen.cc: Needs a cast to `(char *)` before assigning to buf - ext/linenoise-ng/src/linenoise.cpp: Add include for sys/stat.h - modules/util/upgrade_checker/upgrade_check_options.cc: Change int64_t to long long Also note that the cmake code to find antlr4-runtime seems to have multiple problems. Using relative directories for MYSQL_BUILD_DIR and MYSQL_SOURCE_DIR might not work, so use absolute directories
Created attachment 267435 [details] Quick and dirty patch to get MySQL Shell 9.6.0 to build on FreeBSD 15
My build works for MySQL Protocol (port 3306) and X Protocol (port 33060). The \py and \js commands do not work.
Upstream bugs: - https://bugs.mysql.com/bug.php?id=119768 - https://bugs.mysql.com/bug.php?id=119767
If I add `-DHAVE_PYTHON=1` then there is Python support. But also some errors on startup. dveeden@nas2:~/mysqlsh % ./bin/mysqlsh mysqlx://root@127.0.0.1/ Please provide the password for 'root@127.0.0.1': MySQL Shell 9.6.0 Copyright (c) 2016, 2026, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type '\help' or '\?' for help; '\quit' to exit. Creating an X protocol session to 'root@127.0.0.1' Fetching global names for auto-completion... Press ^C to stop. Your MySQL connection id is 23 (X protocol) Server version: 9.5.0 MySQL Community Server - GPL No default schema selected; type \use <schema> to set one. Could not register plugin object 'mds'. ERROR: No module named 'six' Could not register plugin object 'mds'. ERROR: No module named 'six' Could not register plugin object 'gui'. ERROR: No module named '_sqlite3' Could not register plugin object 'gui'. ERROR: No module named '_sqlite3' Could not register plugin object 'msm'. ERROR: unexpected character after line continuation character (general.py, line 128) Could not register plugin object 'msm'. ERROR: unexpected character after line continuation character (general.py, line 128) Could not register plugin object 'mrs'. ERROR: unexpected character after line continuation character (core.py, line 723) Could not register plugin object 'mrs'. ERROR: unexpected character after line continuation character (core.py, line 723) Could not register plugin object 'mds'. ERROR: No module named 'six' Could not register plugin object 'migration'. ERROR: No module named 'six' WARNING: Found errors loading plugins, for more details look at the log at: /home/dveeden/.mysqlsh/mysqlsh.log MySQL 127.0.0.1:33060+ ssl SQL > MySQL 127.0.0.1:33060+ ssl SQL > MySQL 127.0.0.1:33060+ ssl SQL > MySQL 127.0.0.1:33060+ ssl SQL > \py Switching to Python mode... MySQL 127.0.0.1:33060+ ssl Py > import platform MySQL 127.0.0.1:33060+ ssl Py > platform.system() FreeBSD Installing py311-six and py311-cryptography fixed some problems, but not all.
Could someone add this to https://wiki.freebsd.org/WantedPorts ?
Created attachment 267521 [details] First version of a port/patch First version of a patch. This has two sources: mysql-shell and mysql. Both 9.6.0 This uses a mysql-9.6.0 in my homedir instead of the mysql-9.6.0 in the sources. So what needs to happen is: - Make it build mysql - Make mysql-shell use the mysql build just build - OR: make it use database/mysql-server-9.6. However that likely won't work. And besides that: - Testing - Check the %%CMAKE_BUILD_TYPE%%s in the pkg-plist - Check if the Python support works - Add support for javascript/graal
Created attachment 268041 [details] Updated patch
New version of the patch. This now - Builds mysql and mysql-shell (both in the workdir of mysql-shell). - Works for basic operations with Python and SQL. Remaining issues: - There is python package called svg that doesn't seem to have a port. - The python code of MySQL shell seems to require Python 3.14. Mostly some things around f-strings. Seems like it might be possible to patch this. Dan, Mark, Jochen, Could you have a look at this and give it a try? I'm not familiar with the processes around new ports, so I could use some help.
Hi. I could really use some help with this.
(In reply to Daniël van Eeden from comment #15) Sorry, I will try this out later today.
FYI, this won't work with poudriere: post-patch: @cd ${WRKDIR}/mysql-9.6.0 && patch < ../../files/mysql-server.patch It fails because WRKDIR isn't there, it's over here: nobody@150amd64-dvl-testing:/usr/ports/databases/mysql-shell $ make -V WRKDIR /wrkdirs/usr/ports/databases/mysql-shell/work This is better: ${FILESDIR}/mysql-server.patch
When I build, I get: (from https://services.unixathome.org/poudriere/build.html?mastername=150amd64-dvl-testing&build=2026-03-20_15h58m49s) I don't know how this works yet. CMake Warning at cmake/pkg-config.cmake:30 (MESSAGE): Cannot find pkg-config. You need to install the required package: Debian/Ubuntu: apt install pkg-config RedHat/Fedora/Oracle Linux: yum install pkg-config SuSE: zypper install pkg-config Call Stack (most recent call first): configure.cmake:84 (MYSQL_CHECK_PKGCONFIG) CMakeLists.txt:1637 (INCLUDE) CMake Error at /usr/local/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:233 (message): Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) Call Stack (most recent call first): /usr/local/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:603 (_FPHSA_FAILURE_MESSAGE) /usr/local/share/cmake/Modules/FindPkgConfig.cmake:114 (find_package_handle_standard_args) cmake/pkg-config.cmake:37 (FIND_PACKAGE) configure.cmake:84 (MYSQL_CHECK_PKGCONFIG) CMakeLists.txt:1637 (INCLUDE) -- Configuring incomplete, errors occurred! *** Error code 1
First of all: Many, many kudos to Daniël! I did install mysql96-server just two days ago but failed to confirgure Innodb Cluster due to the lack of MySQL Shell port. Found this today. I had to insert the following into the Makefile to proceed: BUILD_DEPENDS= pkgconf:devel/pkgconf \ bison:devel/bison .. and add this to RUN_DEPENDS ... ${PYTHON_PKGNAMEPREFIX}antlr4-python3-runtime>0:devel/py-antlr4-python3-runtime@${PY_FLAVOR} But, now it fails with: ANTLR4 INCLUDE DIR: ANTLR4 LIB DIR: ANTLR4 VERSION: ANTLR4 SHORT VERSION: CMake Error at CMakeLists.txt:716 (message): Could not find antlr4 runtime! I did try devel/antlr4 and devel/libantlr4 as well.
SUCCESS w.r.t. compilation with poudriere (see Makefile attached) I cannot test mysql-shell, yet, because I do not have the experience w.r.t. MySQL Cluster, yet. Invoking mysqlsh starts with: MWN-sql|root> mysqlsh MySQL Shell 9.6.0 Copyright (c) 2016, 2026, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type '\help' or '\?' for help; '\quit' to exit. Could not register plugin object 'migration'. ERROR: f-string expression part cannot include a backslash (logging.py, line 45) Could not register plugin object 'msm'. ERROR: unexpected character after line continuation character (general.py, line 128) Could not register plugin object 'msm'. ERROR: unexpected character after line continuation character (general.py, line 128) Could not register plugin object 'mrs'. ERROR: unexpected character after line continuation character (core.py, line 723) Could not register plugin object 'mrs'. ERROR: unexpected character after line continuation character (core.py, line 723) WARNING: Found errors loading plugins, for more details look at the log at: /root/.mysqlsh/mysqlsh.log MySQL SQL >
Created attachment 268988 [details] Revised Makefile
(In reply to Michael Grimm from comment #21) Please note: #) Disregard the commented line: # ${PYTHON_PKGNAMEPREFIX}antlr4-python3-runtime>0:devel/py-antlr4-python3-runtime@${PY_FLAVOR} #) I have reorganised Makefile to please portclippy and portlint #) There are still some warnings from portlint I haven't solved
(In reply to Michael Grimm from comment #22) Good job. I just ran a poudriere testport. There are conflicts [150amd64-dvl-testing] Installing py311-oci-2.167.2... [150amd64-dvl-testing] `-- Installing py311-cryptography-46.0.5,1... pkg-static: py311-cryptography-46.0.5,1 conflicts with py311-cryptography-legacy-3.4.8_3,1 (installs files into the same place). Problematic file: /usr/local/lib/python3.11/site-packages/cryptography/__about__.py Full log at https://services.unixathome.org/poudriere/build.html?mastername=150amd64-dvl-testing&build=2026-03-22_12h08m11s I may be able to get back to that issue later today.
(In reply to Dan Langille from comment #23) Strange. I ran into the same error yesterday. Thus I modified the first RUN_DEPEND line from: #RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}cryptography>=0:security/py-cryptography@${PY_FLAVOR} \ to: RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}cryptography-legacy>=0:security/py-cryptography-legacy@${PY_FLAVOR} \ After that modification pordriere bulk ran to completion and mysql-shell pkg could be installed successfully.
Using security/py-cryptography got mine to build. https://services.unixathome.org/poudriere/build.html?mastername=150amd64-dvl-testing&build=2026-03-22_15h27m39s That was with python3.11 Next, I tried with DEFAULT_VERSIONS+=python=3.12 I'm thinking we might need to swap that RUN_DEPENDS with whatever version of Python we re buildig with. These builds take at least 20 minutes. I'll report back soon.
Created attachment 269012 [details] Makefile after portfmt
With security/py-cryptography it builds with Python 3.11-3.14 - I think we can go with that. If no objections, I'll commit on Monday morning. I have uploaded the current Makefile, after running portfmt. Python 3.11: https://services.unixathome.org/poudriere/build.html?mastername=150amd64-dvl-testing&build=2026-03-22_15h27m39s Python 3.12: https://services.unixathome.org/poudriere/build.html?mastername=150amd64-dvl-testing&build=2026-03-22_15h52m58s Python 3.13: https://services.unixathome.org/poudriere/build.html?mastername=150amd64-dvl-testing&build=2026-03-22_16h24m47s Python 3.14: https://services.unixathome.org/poudriere/build.html?mastername=150amd64-dvl-testing&build=2026-03-22_16h55m58s
Created attachment 269013 [details] More portlint issues I need to set MASTER_SITES ; I'll work on that soon. More portlint issues: Use DISTVERSION instead of 9.6.0 Move bison from BUILD_DEPENDS to USES Use PREFIX instead of /usr/local in CMAKE_ARGS re: WARN: Makefile: [44]: possible direct use of command "install" found. use ${INSTALL_foobar} instead. WARN: Makefile: possible direct use of "CMAKE_ARGS+= -DBUNDLED_ANTLR_DIR=/usr/local" found. if so, use ${PREFIX} or ${LOCALBASE}, as appropriate. WARN: Makefile: no MASTER_SITES found. is it ok? WARN: Makefile: dependency to bison listed in BUILD_DEPENDS. consider using USES[+]=bison.
(In reply to Dan Langille from comment #26) [portfmt] I am puzzled: #RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}cryptography-legacy>=0:security/py-cryptography-legacy@${PY_FLAVOR} \ RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}cryptography>=0:security/py-cryptography@${PY_FLAVOR} \ Doesn't the continuation line afte the first commented RUN_DEPENDS render the following RUN_DEPENDS block completely commented? That's why I inserted an empty line. I will give it a try with python 3.14
(In reply to Michael Grimm from comment #29) > Doesn't the continuation line afte the first commented RUN_DEPENDS render the following RUN_DEPENDS block completely commented? It shouldn't. It's a comment. If it was, there would be a build error in my Makefile.
(In reply to Dan Langille from comment #28) This fetches the mysql-shell distfiles. USE_GITHUB= yes GH_ACCOUNT= mysql
(In reply to Dan Langille from comment #27) [commit on Monday] Well, this port is still experimental (lots of python errors and warning, and the complete lack of important JavaScript functionality). Perhaps one could advertise this port as beta ;-) Thanks for your and Daniël's efforts, very much appreciated
(In reply to Dan Langille from comment #31) I'm having trouble after running `make distclean` - I can no longer build. ===> Missing license file for GPLv2 in /wrkdirs/usr/ports/databases/mysql-shell/work/mysql-shell-9.6.0-src/LICENSE *** Error code 1 I suspect this is related to USE_GITHUB and the tarballs it downloads.
(In reply to Dan Langille from comment #33) > Perhaps one could advertise this port as beta ;-) Good idea.
(In reply to Dan Langille from comment #33) Notice the significance between my snapshot and the file I have now: [19:00 pkg01 dvl /usr/ports/distfiles/.zfs/snapshot/autosnap_2026-03-21_05:00:06_hourly] % ls -l mysql-shell-9.6.0-src.tar.gz /usr/ports/distfiles/mysql-shell-9.6.0-src.tar.gz -rw-r--r-- 1 root wheel 11635641 2026.03.22 18:30 /usr/ports/distfiles/mysql-shell-9.6.0-src.tar.gz -rw-r--r-- 1 root wheel 184579701 2026.01.05 14:15 mysql-shell-9.6.0-src.tar.gz This move allows the `pourdriere testport` to proceed. [19:01 pkg01 dvl /usr/ports/distfiles/.zfs/snapshot/autosnap_2026-03-21_05:00:06_hourly] % sudo cp mysql-shell-9.6.0-src.tar.gz /usr/ports/distfiles I have no idea where I got the larger distfile.
(In reply to Michael Grimm from comment #29) [retry with] DEFAULT_VERSIONS+= ssl=base pycryptography=legacy python=3.14 failes with (again): pkg-static: py314-cryptography-legacy-3.4.8_3,1 conflicts with py314-cryptography-46.0.5,1 (installs files into the same place). Problematic file: /usr/local/lib/python3.14/site-packages/cryptography/__about__.py Failed to install the following 1 package(s): /packages/All/py314-oci-2.167.2.pkg *** Error code 1 Now, I do know why (due to pycryptography=legacy): DEFAULT_VERSIONS+= ssl=base python=3.14 Without "pycryptography=legacy", the port compiles fine. I am pretty sure that may have "pycryptography=legacy" in their DEFAULT_VERSIONS, though ...
This looks like some very good progress :)
(In reply to Dan Langille from comment #33) That's my sticking point at the moment. I have to come back to this and test again. I need to verify that all distfiles are fetched when not local.
^Triage: as bugmeister, try to rescue this from the trash bin. a) take all the files from "Updated patch" (patch #3) by Daniël van Eeden, except for the Makefile. b) take the Makefile from "More portlint issues" (patch #6) by dvl, and turn that into a git diff file. c) fix various complaints from portlint and 'make patch'. Note: I have done no further testing past 'make patch'. Also note: the current version is shown as 9.7.0 on the mastersite. This is left as an exercise for the reader.
Created attachment 272584 [details] git diff for new port databases/mysql-shell ^Triage: attempt to unify and update various patches.
Is anyone working on the new port? If not, I’d be happy to take it on.
(In reply to Jochen Neumeister from comment #41) I am not, please proceed. Thank you.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=5d982828f5080691bdc69617965d03e6ced51174 commit 5d982828f5080691bdc69617965d03e6ced51174 Author: Jochen Neumeister <joneum@FreeBSD.org> AuthorDate: 2026-08-13 20:29:16 +0000 Commit: Jochen Neumeister <joneum@FreeBSD.org> CommitDate: 2026-08-13 20:29:52 +0000 databases/mysql-shell: Add New Port MySQL Shell is an advanced client and code editor for MySQL with support for SQL and Python scripting, both the classic and the X protocol, and the AdminAPI. It builds its own copy of the MySQL 9.7.1 source tree to obtain the static client libraries. JavaScript mode is not available since the GraalVM polyglot runtime has not been ported to FreeBSD; see pkg-message. PR: 291004 Co-authored-by: Daniel van Eeden <freebsd@myname.nl> Co-authored-by: Dan Langille <dvl@FreeBSD.org> Sponsored by: Netzkommune GmbH databases/mysql-shell: Add New Port MySQL Shell is an advanced client and code editor for MySQL with support for SQL and Python scripting, both the classic and the X protocol, and the AdminAPI. It builds its own copy of the MySQL 9.7.1 source tree to obtain the static client libraries. JavaScript mode is not available since the GraalVM polyglot runtime has not been ported to FreeBSD; see pkg-message. PR: 291004 Co-authored-by: Daniel van Eeden <freebsd@myname.nl> Co-authored-by: Dan Langille <dvl@FreeBSD.org> Sponsored by: Netzkommune GmbH databases/Makefile | 1 + databases/mysql-shell/Makefile (new) | 61 + databases/mysql-shell/distinfo (new) | 5 + .../mysql-shell/files/mysql-server.patch (new) | 43 + .../patch-ext_linenoise-ng_src_linenoise.cpp (new) | 10 + ...grade__checker_upgrade__check__options.cc (new) | 18 + ...ysqlshdk_libs_ssh_ssh__tunnel__handler.cc (new) | 15 + .../patch-mysqlshdk_libs_utils_logger.cc (new) | 10 + .../patch-mysqlshdk_libs_utils_strformat.h (new) | 10 + ...patch-mysqlshdk_libs_utils_utils__file.cc (new) | 51 + ...ch-mysqlshdk_libs_utils_utils__general.cc (new) | 31 + ...tch-mysqlshdk_libs_utils_utils__general.h (new) | 12 + .../patch-mysqlshdk_libs_utils_utils__net.cc (new) | 13 + .../patch-mysqlshdk_libs_utils_utils__os.cc (new) | 21 + .../patch-mysqlshdk_libs_utils_uuid__gen.cc (new) | 11 + databases/mysql-shell/pkg-descr (new) | 4 + databases/mysql-shell/pkg-message (new) | 7 + databases/mysql-shell/pkg-plist (new) | 1657 ++++++++++++++++++++ 18 files changed, 1980 insertions(+)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=720fdb09dd460531ba9f4829f2947d3063c6156d commit 720fdb09dd460531ba9f4829f2947d3063c6156d Author: Jochen Neumeister <joneum@FreeBSD.org> AuthorDate: 2026-08-13 19:05:36 +0000 Commit: Jochen Neumeister <joneum@FreeBSD.org> CommitDate: 2026-08-13 20:29:51 +0000 graphics/py-svg.py: Add New Port Type-safe SVG drawing library for Python. Required as a runtime dependency of the upcoming databases/mysql-shell port. PR: 291004 Sponsored by: Netzkommune GmbH graphics/Makefile | 1 + graphics/py-svg.py/Makefile (new) | 21 +++++++++++++++++++++ graphics/py-svg.py/distinfo (new) | 3 +++ graphics/py-svg.py/pkg-descr (new) | 4 ++++ 4 files changed, 29 insertions(+)
Done. If anyone would like to take over the maintainership, please fell free.
Thank you, I appreciate the work you did on this. Much better than I could have done.