我如何如下登录BaseX
:
nicholas :
nicholas : basex
BaseX 9.0.1 [Standalone]
Try 'help' to get more information.
>
> show users
Username Permission
--------------------
admin admin
nicholas none
2 user(s).
>
> password
Password:
Password of user 'admin' changed.
>
> xquery user:list-details()[@name = 'admin']
<user name="admin" permission="admin">
<password algorithm="digest">
<hash>1362341e2a498e998e8ca9f2bba300ee</hash>
</password>
<password algorithm="salted-sha256">
<salt>30102517356373</salt>
<hash>749d806e4ef549e381809d59723267cf44d910047d7fde074e0370027bbad7b9</hash>
</password>
</user>
Query executed in 235.21 ms.
>
> exit
Have fun.
nicholas :
nicholas : python3 basex.py
Traceback (most recent call last):
File "basex.py", line 4, in <module>
session = BaseXClient.Session('localhost', 1984, 'admin', 'admin')
File "/usr/local/lib/python3.8/dist-packages/BaseXClient/BaseXClient.py", line 116, in __init__
self.__swrapper.connect((host, port))
File "/usr/local/lib/python3.8/dist-packages/BaseXClient/BaseXClient.py", line 92, in <lambda>
return lambda *arg, **kw: getattr(self.__s, name)(*arg, **kw)
ConnectionRefusedError: [Errno 111] Connection refused
nicholas :
使用sample Python为:
from BaseXClient import BaseXClient
from parsel import Selector
session = BaseXClient.Session('localhost', 1984, 'admin', 'admin')
print(session.info())
# create new database
session.create("database", "<x>Hello World!</x>")
print(session.info())
# run query on database
print("\n" + session.execute("xquery doc('database')"))
# drop database
# session.execute("drop db database")
print(session.info())
#finally:
# close session
if session:
session.close()
我只能重设密码多次。
也许在standalone
模式下无法使用?
https://docs.basex.org/wiki/Database_Server
说:
服务器
数据库服务器处理并发的读写事务, 管理用户权限并记录用户交互。可以开始 如下:
Run one of the basexserver or basexserver.bat scripts. Add the stop keyword to gracefully shut down the server. If you have installed BaseX on Windows, click on the BaseX HTTP Server (Start) icon, which will start both the HTTP Server used for
Web应用程序和数据库服务器。使用BaseX HTTP Server (停止),您可以关闭服务器进程。
默认情况下,服务器侦听端口1984。按Ctrl + c将 关闭所有连接和数据库,并正常关闭 服务器进程。
各种命令行选项可简化批处理 处理。可以针对个人目的调整启动脚本 (例如,如果默认内存限制太严格)。
您需要运行basexserver才能通过客户端API连接到它。