|
2 | 2 | outline: deep |
3 | 3 | --- |
4 | 4 |
|
5 | | -Occupancy pending construction |
| 5 | +# Please Report Issues to the Corresponding Repository |
| 6 | + |
| 7 | +## What to Do If You Forgot the Administrator Password |
| 8 | + |
| 9 | +You need to forcibly change the password through database operations |
| 10 | + |
| 11 | +1. Generate Password Hash |
| 12 | + |
| 13 | +```bash |
| 14 | +# Generate using Python (replace NewPassword123! with your new password) |
| 15 | +python3 -c "import bcrypt; print(bcrypt.hashpw(b'NewPassword123!', bcrypt.gensalt()).decode('utf-8'))" |
| 16 | +``` |
| 17 | + |
| 18 | +Example output: `$2b$12$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` |
| 19 | + |
| 20 | +2. Enter the Database |
| 21 | + |
| 22 | +**Docker Deployment (All-in-One Version):** |
| 23 | +```bash |
| 24 | +docker exec -it oneclickvirt mysql -u root oneclickvirt |
| 25 | +``` |
| 26 | + |
| 27 | +**Standalone Database Deployment:** |
| 28 | +```bash |
| 29 | +mysql -h 127.0.0.1 -P 3306 -u root -p oneclickvirt |
| 30 | +``` |
| 31 | + |
| 32 | +3. Update Password |
| 33 | + |
| 34 | +```sql |
| 35 | +-- View administrator account |
| 36 | +SELECT id, username, user_type FROM users WHERE user_type = 'admin'; |
| 37 | + |
| 38 | +-- Update password (replace with the hash value generated in step 1) |
| 39 | +UPDATE users |
| 40 | +SET password = '$2b$12$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' |
| 41 | +WHERE username = 'admin'; |
| 42 | + |
| 43 | +-- Exit |
| 44 | +EXIT; |
| 45 | +``` |
| 46 | + |
| 47 | +4. Login Test |
| 48 | + |
| 49 | +Log in to the system with the new password to verify. |
| 50 | + |
| 51 | +**Notes** |
| 52 | + |
| 53 | +- The hash value must start with `$2a$`, `$2b$`, or `$2y$` |
| 54 | +- The default administrator username is `admin`, which can be confirmed through a query |
| 55 | +- It is recommended to use a strong password (≥8 characters, containing uppercase and lowercase letters, numbers, and special characters) |
| 56 | +- It is recommended to backup the database before modification: |
| 57 | + ```bash |
| 58 | + docker exec oneclickvirt mysqldump -u root oneclickvirt > backup.sql |
| 59 | + ``` |
| 60 | + |
| 61 | +## How to Delete Persistent Database and Storage Volumes in Docker |
| 62 | + |
| 63 | +After deleting the corresponding container |
| 64 | + |
| 65 | +Execute |
| 66 | + |
| 67 | +```shell |
| 68 | +docker volume rm oneclickvirt-data oneclickvirt-storage oneclickvirt-config |
| 69 | +``` |
| 70 | + |
| 71 | +to delete |
0 commit comments