[root@jumpserver ~]# systemctl enable mysqld --now[root@jumpserver ~]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2024-01-04 04:40:59 CST; 7s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 1669ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 1737(mysqld)
Status: "Server is operational"
CGroup: /system.slice/mysqld.service
└─1737 /usr/sbin/mysqld
Jan 04 04:40:55 jumpserver systemd[1]: Starting MySQL Server...
Jan 04 04:40:59 jumpserver systemd[1]: Started MySQL Server.
[root@jumpserver ~]# mysql -V
mysql Ver 8.0.35 for Linux on x86_64 (MySQL Community Server - GPL)
获取密码
[root@jumpserver ~]# grep 'password' /var/log/mysqld.log 2024-01-03T20:40:56.767679Z 6[Note][MY-010454][Server] A temporary password is generated for root@localhost: pf!oV)rfO9iq
修改my.cnf
[root@jumpserver ~]# vim /etc/my.cnf
### 在[mysqld]的下方加入
plugin-load-add=validate_password.so
validate-password=FORCE_PLUS_PERMANENT
重启服务
[root@jumpserver ~]# systemctl restart mysqld
修改mysql密码策略
[root@jumpserver ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.0.35 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> show variables like 'validate_password%';
+-------------------------------------------------+--------+
| Variable_name | Value |
+-------------------------------------------------+--------+
| validate_password.changed_characters_percentage | 0 |
| validate_password.check_user_name | ON |
| validate_password.dictionary_file | |
| validate_password.length | 8 |
| validate_password.mixed_case_count | 1 |
| validate_password.number_count | 1 |
| validate_password.policy | MEDIUM |
| validate_password.special_char_count | 1 |
| validate_password_check_user_name | ON |
| validate_password_dictionary_file | |
| validate_password_length | 8 |
| validate_password_mixed_case_count | 1 |
| validate_password_number_count | 1 |
| validate_password_policy | MEDIUM |
| validate_password_special_char_count | 1 |
+-------------------------------------------------+--------+
15 rows in set (0.00 sec)
mysql> set global validate_password.policy=0;
Query OK, 0 rows affected (0.00 sec)
mysql> set global validate_password.length=6;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> alter user 'root'@'localhost' identified by '000000';
Query OK, 0 rows affected (0.00 sec)
配置权限
mysql> create user root@'%' identified by '000000';
Query OK, 0 rows affected (0.01 sec)
mysql> grant all privileges on *.* to root@'%' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> select user, host from mysql.user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| root | % |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+------------------+-----------+
5 rows in set (0.00 sec)
mysql> create database jumpserver default charset 'utf8';
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
[root@jumpserver ~]# tar -zxvf jumpserver-offline-installer-v3.10.1-amd64.tar.gz -C /usr/local/src/[root@jumpserver jumpserver-offline-installer-v3.10.1-amd64]# ./jmsctl.sh install
配置外部mysql和redis
>>> Install and Configure JumpServer
1. Configure Private Key
SECRETE_KEY: ZTVjYzRkNTYtZmZhZi1iYzhiLTE5ODAtZjE4MzkwYTNlNzkw
BOOTSTRAP_TOKEN: ZTVjYzRkNTYtZmZhZi1iYzhi
complete
2. Configure Persistent Directory
Do you need custom persistent store, will use the default directory /data/jumpserver? (y/n)(default n): y
To modify the persistent directory such as logs video, you can select your largest disk and create a directory in it, such as /data/jumpserver
Note: you can not change it after installation, otherwise the database may be lost
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 17G 16G 1.7G 91% /
Persistent storage directory (default /data/jumpserver):
complete
3. Configure MySQL
Do you want to use external MySQL? (y/n)(default n): y
Please enter MySQL server IP (default mysql): 192.168.169.202
Please enter MySQL server port (default 3306):
Please enter MySQL database name (default jumpserver):
Please enter MySQL username (default root):
Please enter MySQL password (no default): 000000
complete
4. Configure Redis
Do you want to use external Redis? (y/n)(default n): y
Please enter Redis server IP (default redis): 192.168.169.202
Please enter Redis server port (default 6379):
Please enter Redis password (no default):
complete
5. Configure External Access
Do you need to customize the JumpServer external port? (y/n)(default n): n
complete
6. Init JumpServer Database
[+] Building 0.0s (0/0) docker:default
[+] Running 1/0
✔ Container jms_core Running 0.0s
2024-01-03 23:16:23 Collect static files
ALLOWED_HOSTS:
- localhost
- core:8080
- 127.0.0.1
- 127.0.0.1:8080
- 127.0.0.1:80
- localhost:8080
- localhost:80
- core:8080
- core:80
ALLOWED_HOSTS:
- localhost
- core:8080
- 127.0.0.1
- 127.0.0.1:8080
- 127.0.0.1:80
- localhost:8080
- localhost:80
- core:8080
- core:80