MySQL 사용자 이름과 비밀번호를 어떻게 검색합니까?
MySQL 사용자 이름과 비밀번호를 잃어 버렸습니다. 어떻게 검색합니까?
MySQL 프로세스를 중지하십시오.
--skip-grant-tables 옵션을 사용하여 MySQL 프로세스를 시작하십시오.
-u root 옵션을 사용하여 MySQL 콘솔 클라이언트를 시작하십시오.
모든 사용자를 나열하십시오.
SELECT * FROM mysql.user;
암호를 재설정;
UPDATE mysql.user SET Password=PASSWORD('[password]') WHERE User='[username]';
그러나 잊지 마세요 에
MySQL 프로세스 중지
MySQL 프로세스를 정상적으로 시작하십시오 (즉 --skip-grant-tables 옵션없이)
당신이 끝나면. 그렇지 않으면 데이터베이스의 보안이 손상 될 수 있습니다.
불행히도 사용자 비밀번호는 검색 할 수 없습니다. 모르는 경우 되돌릴 수없는 단방향 해시로 해시되었습니다. 위의 Xenph Yan과 함께 새로운 것을 만드십시오.
Windows에서 MySQL 루트 계정 의 비밀번호를 재설정하기 위해 매뉴얼 에서 다음 절차를 사용할 수도 있습니다 .
- 시스템에 관리자로 로그온하십시오.
- MySQL 서버가 실행 중이면 중지하십시오. Windows 서비스로 실행중인 서버의 경우 서비스 관리자로 이동하십시오.
시작 메뉴-> 제어판-> 관리 도구-> 서비스
그런 다음 목록에서 MySQL 서비스를 찾아 중지하십시오. 서버가 서비스로 실행되고 있지 않으면 작업 관리자를 사용하여 강제로 중지해야 할 수도 있습니다.
텍스트 파일을 작성하고 다음 명령문을 배치하십시오. 비밀번호를 사용하려는 비밀번호로 바꾸십시오.
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root'; FLUSH PRIVILEGES;
UPDATE 및 FLUSH 문 각각 한 줄에 작성해야합니다. UPDATE의 문은 기존의 모든 루트 계정에 대한 암호를 다시 설정하고, 플러시 문은 메모리에 그랜트 테이블을 다시로드 할 수있는 서버를 알려줍니다.
- 파일을 저장하십시오. 이 예에서 파일 이름은 C : \ mysql-init.txt입니다.
콘솔 창을 열어 명령 프롬프트를 표시하십시오.
시작 메뉴-> 실행-> cmd
특수한 --init-file 옵션을 사용하여 MySQL 서버를 시작하십시오 .
C:\> C:\mysql\bin\mysqld-nt --init-file = C:\mysql-init.txt
C : \ mysql 이외의 위치에 MySQL을 설치 한 경우 이에 따라 명령을 조정하십시오.
서버 는 시작할 때 --init-file 옵션으로 이름이 지정된 파일의 내용을 실행하여 각 루트 계정 비밀번호를 변경 합니다.
서버 출력을 로그 파일이 아닌 콘솔 창에 표시하려면 명령에 --console 옵션을 추가 할 수도 있습니다 .
MySQL 설치 마법사를 사용하여 MySQL을 설치 한 경우 --defaults-file 옵션 을 지정해야합니다 .
C:\> "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt.exe" --defaults-file="C:\Program Files\MySQL\MySQL Server 5.0\my.ini" --init-file=C:\mysql-init.txt
적절한 --defaults-file 설정은 서비스 관리자를 사용하여 찾을 수 있습니다.
시작 메뉴-> 제어판-> 관리 도구-> 서비스
목록에서 MySQL 서비스를 찾아 마우스 오른쪽 단추로 클릭 한 후 속성 옵션을 선택하십시오. 실행 파일 경로 필드에는 --defaults-file 설정이 포함되어 있습니다 .
- 서버가 성공적으로 시작되면 C : \ mysql-init.txt를 삭제 하십시오 .
- MySQL 서버를 중지 한 다음 일반 모드에서 다시 시작하십시오. 서버를 서비스로 실행하는 경우 Windows 서비스 창에서 서버를 시작하십시오. 서버를 수동으로 시작하는 경우 일반적으로 사용하는 명령을 사용하십시오.
이제 새 비밀번호를 사용하여 루트로 MySQL에 연결할 수 있습니다.
가장 유용한 답변이 여기에 개선되었습니다.
1] mysql 서버를 다시 시작할 필요가 없습니다.
2] 네트워크에 연결된 MySQL 서버의 보안 문제
MySQL 서버를 다시 시작할 필요가 없습니다.
사용 FLUSH PRIVILEGES;
암호 변경에 대한 업데이트 mysql 데이터베이스에서 user 문 뒤에.
FLUSH 문은 서버에게 암호 변경을 알 수 있도록 권한 부여 테이블을 메모리에 다시로드하도록 지시합니다.
는 --skip-grant-options
암호없이 모든 권한과 연결하는 사람을 할 수 있습니다. 이것은 안전하지 않기 때문에
원격 클라이언트가 연결되지 않도록 --skip-networking 과 함께 --skip-grant-tables 를 사용하십시오 .
from : 참조 : 재설정 권한-일반
무차별 공격없이 MySQL 암호를 직접 복구 할 수는 없지만 다른 방법이있을 수 있습니다. MySQL Workbench를 사용하여 데이터베이스에 연결하고 자격 증명을 "vault"에 저장 한 경우 황금색입니다.
On Windows, the credentials are stored in %APPDATA%\MySQL\Workbench\workbench_user_data.dat - encrypted with CryptProtectData (without any additional entropy). Decrypting is easy peasy:
std::vector<unsigned char> decrypt(BYTE *input, size_t length) {
DATA_BLOB inblob { length, input };
DATA_BLOB outblob;
if (!CryptUnprotectData(&inblob, NULL, NULL, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN, &outblob)) {
throw std::runtime_error("Couldn't decrypt");
}
std::vector<unsigned char> output(length);
memcpy(&output[0], outblob.pbData, outblob.cbData);
return output;
}
Or you can check out this DonationCoder thread for source + executable of a quick-and-dirty implementation.
If you have root access to the server where mysql is running you should stop the mysql server using this command
sudo service mysql stop
Now start mysql using this command
sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &
Now you can login to mysql using
sudo mysql
FLUSH PRIVILEGES;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');
Full instructions can be found here http://www.techmatterz.com/recover-mysql-root-password/
Do it without down time
Run following command in the Terminal to connect to the DBMS (you need root access):
sudo mysql -u root -p;
run update password of the target user (for my example username is mousavi
and it's password must be 123456
):
UPDATE mysql.user SET authentication_string=PASSWORD('123456') WHERE user='mousavi';
at this point you need to do a flush to apply changes:
FLUSH PRIVILEGES;
Done! You did it without any stop or restart mysql service.
Login MySql from windows cmd using existing user:
mysql -u username -p
Enter password:****
Then run the following command:
mysql> SELECT * FROM mysql.user;
After that copy encrypted md5 password for corresponding user and there are several online password decrypted application available in web. Using this decrypt password and use this for login in next time. or update user password using flowing command:
mysql> UPDATE mysql.user SET Password=PASSWORD('[password]') WHERE User='[username]';
Then login using the new password and user.
Although a strict, logical, computer science'ish interpretation of the op's question would be to require both "How do I retrieve my MySQL username" and "password" - I thought It might be useful to someone to also address the OR interpretation. In other words ...
1) How do I retrieve my MySQL username?
OR
2) password
This latter condition seems to have been amply addressed already so I won't bother with it. The following is a solution for the case "How do i retreive my MySQL username" alone. HIH.
To find your mysql username run the following commands from the mysql shell ...
SELECT User FROM mysql.user;
it will print a table of all mysql users.
IF you happen to have ODBC set up, you can get the password from the ODBC config file. This is in /etc/odbc.ini for Linux and in the Software/ODBC folder in the registry in Windows (there are several - it may take some hunting)
For window user, you can follow this guide to reset your password
참고URL : https://stackoverflow.com/questions/4371/how-do-i-retrieve-my-mysql-username-and-password
'IT story' 카테고리의 다른 글
서버를 다시 시작하지 않고 MySQL 쿼리 캐시 지우기 (0) | 2020.06.10 |
---|---|
OAuth 인증 코드와 암시 적 워크 플로의 차이점은 무엇입니까? (0) | 2020.06.10 |
여러 조건이있는 AngularJS ng-if (0) | 2020.06.10 |
C 스타일 배열에서 std :: vector를 초기화하는 방법은 무엇입니까? (0) | 2020.06.10 |
이름이 문자열 인 모든 파일 찾기 (0) | 2020.06.10 |