
Linux에서 MariaDB 루트 비밀번호를 재설정하는 방법
MariaDB 루트 비밀번호를 잊으셨습니까? 당신은 그것을 복구하는 방법을 모릅니다. 걱정하지 마세요. 이 튜토리얼은 Linux 시스템에서 MariaDB 루트 비밀번호를 재설정하는 데 도움이 될 것입니다.
이 단계별 자습서를 따라 Linux 시스템에서 MariaDB 루트 암호를 재설정해 보겠습니다.
> UPDATE 사용자 SET authentication_string = password("SecreT") 여기서 User='root';
> FLUSH PRIVILEGES;123> mysql 사용;> UPDATE user SET authentication_string = password("SecreT") where User='root';> FLUSH PRIVILEGES;

1단계 – 안전 모드에서 MariaDB 시작
먼저 시스템에서 MariaDB 서비스를 중지해야 합니다. 다음 명령을 사용하여 이 작업을 수행할 수 있습니다.이제 skip grant를 사용하여 안전 모드에서 MariaDB 서비스를 시작하고 백그라운드에서 이 명령을 실행합니다.sudo systemctl stop mysql.service
mysqld_safe --skip-grant-tables &
2단계 – 비밀번호 변경
안전한 MariaDB를 시작한 후 루트 사용자와 암호 없이 MariaDB에 더 연결합니다. 그런 다음 다음 명령을 실행하여 루트 사용자 암호를 변경합니다.> mysql을 사용하십시오.mysql -u root
> UPDATE 사용자 SET authentication_string = password("SecreT") 여기서 User='root';
> FLUSH PRIVILEGES;123> mysql 사용;> UPDATE user SET authentication_string = password("SecreT") where User='root';> FLUSH PRIVILEGES;
3단계 – MariaDB 중지 및 시작
암호를 성공적으로 변경한 후 MariaDB 서비스를 중지하고 다음 명령을 사용하여 일반 모드에서 다시 시작합니다.sudo systemctl stop mysql.service sudo systemctl start mysql.service
4단계 – 새 비밀번호로 로그인
이제 MariaDB 인스턴스에 대한 새 루트 사용자 암호가 있습니다. MariaDB 인스턴스에 로그인하여 새 비밀번호를 확인하십시오.mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 10.1.26-MariaDB-0+deb9u1 Debian 9.1 Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>