Milvus密码修改

安装python模块

pip3 install pymilvus

执行脚本

from pymilvus import MilvusClient
import logging

# Configure logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')

def update_password(uri, username, password, new_password):
try:
# Create MilvusClient instance
try:
client_res = client = MilvusClient(
uri=uri,
token=f"{username}:{password}"
)
except Exception as e:
logging.error(e._state.details)
exit(1)

update_res = client.update_password(user_name=username, old_password=password, new_password=new_password)
logging.info(f"Password updated successfully! New password: {new_password}")
except Exception as e:
logging.error(f"Failed to update password: {e}")

if __name__ == "__main__":
uri = 'http://192.168.1.16:19530' # Replace with your Milvus server address
username = "root"
password = "Milvus"
new_password = "123456"
update_password(uri, username, password, new_password)

执行结果

2024-09-04 17:26:27,011 - DEBUG - Created new connection using: 8f39b138091e4f699e72ac5e49a3836d
2024-09-04 17:26:27,017 - INFO - Password updated successfully! New password: 123456
文章作者: 慕容峻才
文章链接: https://www.acaiblog.top/Milvus密码修改/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 阿才的博客
微信打赏
支付宝打赏