我正在尝试使用Cloud Shell来更新一些用户权限。我正在使用gcloud sql connect my-instance --user=root
gcloud sql connect my-instance
Whitelisting your IP for incoming connection for 5 minutes...done.
Connecting to database with SQL user [sqlserver].********************************************************************************
Python command will soon point to Python v3.7.3.
Python 2 will be sunsetting on January 1, 2020.
See http://https://www.python.org/doc/sunset-python-2/
Until then, you can continue using Python 2 at /usr/bin/python2, but soon
/usr/bin/python symlink will point to /usr/local/bin/python3.
To suppress this warning, create an empty ~/.cloudshell/no-python-warning file.
The command will automatically proceed in seconds or on any key.
********************************************************************************
> Password:
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/dist-packages/mssqlcli/main.py", line 117, in <module>
main()
File "/usr/local/lib/python2.7/dist-packages/mssqlcli/main.py", line 110, in main
run_cli_with(mssqlcli_options)
File "/usr/local/lib/python2.7/dist-packages/mssqlcli/main.py", line 43, in run_cli_with
from mssqlcli.mssql_cli import MssqlCli
File "/usr/local/lib/python2.7/dist-packages/mssqlcli/mssql_cli.py", line 18, in <module>
from prompt_toolkit.shortcuts import PromptSession, CompleteStyle
ImportError: cannot import name PromptSession
A(我使root
用户的密码如此不安全和容易,我不可能打错它。
B(现在是1月3日,所以我真的不知道这个Python版本错误是关于什么的。我制作了文件,但仅供参考~/.cloudshell
不存在,所以我必须先制作它。即便如此,它只是抑制了版本警告,当我尝试登录时,主要错误仍然存在。
文档承认还有其他几种使用glcoud beta sql connect
的登录方法,但这给我带来了另一个错误
2020/01/04 18:38:41 Rlimits for file descriptors set to {&{8500 1048576}}
2020/01/04 18:38:41 invalid json file "/tmp/tmp.s38C662KKr/legacy_credentials/me@gmail.com/adc.json": open /tmp/tmp.s38C662KKr/legacy_credentials/me@gmail.com/adc.json: no such file or directory
ERROR: (gcloud.beta.sql.connect) Failed to start the Cloud SQL Proxy.
alpha
也一样。
这是我在Cloud Shell中输入的第一件事,所以我无法想象是什么破坏了PromptSession。
如何解决此错误并使用 Cloud Shell 登录 SQL Server?
尝试从Cloud Shell连接时很可能出现问题(我设法使用此命令从计算引擎实例连接(;可能与Python运行时/环境变量有关。这里已经报道过了。工程部门意识到并正在研究它。