>  기사  >  데이터 베이스  >  Linux에서 mysql 비밀번호를 확인하는 방법

Linux에서 mysql 비밀번호를 확인하는 방법

WBOY
WBOY앞으로
2023-05-26 23:22:493841검색

많은 친구들이 비밀번호를 잊어버린 경험을 했다고 생각합니다. Linux에서 MySQL 비밀번호를 잊어버린 경우 어떻게 해야 합니까?

Linux에서 mysql 비밀번호를 보는 구체적인 방법.

기본 비밀번호 보기

grep ‘임시 비밀번호’ /var/log/mysqld.log

또는

cat /var/log/mysqld.log | grep ‘임시 비밀번호’
 [root@VM_0_11_centos ~]# grep 'temporary password' /var/log/mysqld.log
 2020-05-07T16:57:52.623306Z 1 [Note] A temporary password is generated for root@localhost: Ukyool6&htfu

비밀번호 변경

비밀번호를 처음 변경할 때 비밀번호에는 문자, 숫자, 특수문자가 포함되어야 한다는 점 주의하셔야 합니다. (대소문자가 모두 포함되어야 하며 길이는 8자 이상이어야 합니다.)

 [root@VM_0_11_centos ~]# mysql -uroot -p
 Enter password:
 Welcome to the MySQL monitor.  Commands end with ; or \g.
 Your MySQL connection id is 1721
 Server version: 5.7.30 MySQL Community Server (GPL)
 
 Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
 
 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 databases;
 ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
 mysql> alter user root@localhost identified by 'root!@#123';
 ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
 mysql>  SHOW VARIABLES LIKE 'validate_password%';
 ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
 mysql> alter user root@localhost identified by 'Root!@#123';
 Query OK, 0 rows affected (0.00 sec)
 
 mysql> SHOW VARIABLES LIKE 'validate_password%';
 +--------------------------------------+--------+
 | Variable_name                        | Value  |
 +--------------------------------------+--------+
 | validate_password_check_user_name    | OFF    |
 | 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      |
 +--------------------------------------+--------+
 7 rows in set (0.01 sec)
 
 mysql> use mysql;
 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> select Host,User from user;
 +-----------+---------------+
 | Host      | User          |
 +-----------+---------------+
 | localhost | mysql.session |
 | localhost | mysql.sys     |
 | localhost | root          |
 +-----------+---------------+
 3 rows in set (0.00 sec)
 
 mysql>

mysql 비밀번호 정책 관련 매개변수에 대해

1), verify_password_length 고정 비밀번호 총 길이

2), verify_password_dictionary_file은 비밀번호 확인을 위한 파일 경로를 지정합니다.

3), 전체 비밀번호에는 최소한 총 개수가 포함되어야 합니다.

4), verify_password_number_count 전체 비밀번호에는 최소한 아랍어 숫자가 포함되어야 합니다.

5), verify_password_policy는 비밀번호의 강도 확인 수준을 지정하며 기본값은

값입니다. verify_password_policy:

0/LOW: 길이만 확인합니다.

1/MEDIUM: 길이, 숫자, 대문자 및 소문자, 특수 문자를 확인합니다.

2/STRONG: 길이, 숫자, 대문자 및 소문자, 특수 문자를 확인합니다. , 사전 파일

6), verify_password_special_char_count 전체 비밀번호에는 최소한

개의 특수 문자가 포함되어야 합니다.

위 내용은 Linux에서 mysql 비밀번호를 확인하는 방법의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
이 기사는 yisu.com에서 복제됩니다. 침해가 있는 경우 admin@php.cn으로 문의하시기 바랍니다. 삭제