0

我正在用 python 编写代码来自动化 innodb 集群配置。基于此示例 https://dev.mysql.com/doc/dev/mysqlsh-api-python/8.0/group__mysql.html

mysql-py> from mysqlsh import mysql
 
// Then you can use the module functions and properties
// for example to create a session
mysql-py> mySession = mysql.get_classic_session('admin@localhost')

我很好奇是否有办法在 mysql shell 之外加载 mysqlsh 模块。

例如

[Clang 12.0.5 (clang-1205.0.22.9)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from mysqlsh import mysql
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'mysqlsh'
4

0 回答 0