halo密码重置-通过修改数据库
halo密码重置-通过修改数据库
思路
进入部署了mysql的docker容器,执行sql命令直接修改用户的密码
过程展示
root@iZ2zed38f6uncinmnw25dsZ:~/docker/halo2# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d935278acda6 halohub/halo:2.11 "sh -c 'java ${JVM_O…" 6 days ago Up 6 days (healthy) 0.0.0.0:80->8090/tcp, :::80->8090/tcp halo
b765da55c203 mysql:8.1.0 "docker-entrypoint.s…" 6 days ago Up 6 days (healthy) 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp halodb
root@iZ2zed38f6uncinmnw25dsZ:~/docker/halo2# docker exec -it b765da55c203 /bin/bash
bash-4.4# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 170763
Server version: 8.1.0 MySQL Community Server - GPL
Copyright (c) 2000, 2023, 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 '\h' for help. Type '\c' to clear the current input statement.
mysql> use halo
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> UPDATE
-> extensions
-> SET
-> data = JSON_SET(
-> CONVERT(data USING utf8mb4),
-> '$.spec.password',
-> '{bcrypt}$2a$10$7tBEL1sNQSr/uWtLZHLmCeA9IGx0I9/Jz//3Uwo/anIm9xdxv.xrO'
-> )
-> WHERE
-> name LIKE '/registry/users/admin'; # 注意将admin换成自己的用户名
修改之后密码被重置为password
License:
CC BY 4.0