SQL 서버의 루트 비밀번호를 복구하는 방법을 배우는 단계별 튜토리얼입니다.
서버의 가장 중요한 사용자 MySQL 확실히 사용자입니다 “root“. 이 사용자는 모든 것을 가지고 있습니다 행정 특권 데이터베이스의 경우(MySQL databases).
MySQL 루트 사용자의 비밀번호를 더 이상 모르는 경우, 몇 가지 간단한 단계에 따라 비밀번호를 재설정해야 합니다.
튜토리얼은 서버용으로 제작되었습니다. MySQL 운영 체제에 설치됨 센토스, 그러나 프로세스는 다른 Linux 배포판에서도 동일합니다.
SQL 서버의 사용자 루트의 비밀번호를 복구하는 방법
SQL Server 루트 사용자의 비밀번호를 복구하는 가장 간단한 방법은 다음과 같습니다. SSH (Secure Shell).
1. 사용자로 로그인합니다 “root” MySQL 서버가 있는 시스템에. (MySQL 서버가 아닌 시스템의 루트 사용자) 콘솔에서 직접 로그인하거나 연결을 통해 원격으로 로그인하세요. SSH (Cu 퍼티 Windows 시스템의 경우).
2. MySQL 프로세스/서버를 중지합니다.
service mysqld stop
또는
/etc/init.d/mysqld stop
결과는 다음과 같습니다:
Stopping MySQL: [ OK ]
3. 옵션을 사용하여 MySQL 서버를 시작합니다. “--skip-grant-tables“. 비밀번호 없이 MySQL 서버/데몬 프로세스를 시작합니다.
mysqld_safe --skip-grant-tables &
위 명령줄 이후의 출력은 다음과 같습니다.
[1] 3041
[root@server ~]# Starting mysqld daemon with databases from /var/lib/mysql
4. 사용자와 함께 mysql 서버에 연결합니다 “root“, 다음 명령을 사용하여:
mysql -u root
주문 결과:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1
Server version: 5.0.77 Source distribution
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
mysql>
5. mysql 데이터베이스를 선택하고 사용자의 새 비밀번호를 설정합니다. “root“.
use mysql;
update user set password=PASSWORD("New_Password") where User='root';
flush privileges;
quit
위 명령의 결과:
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> update user set password=PASSWORD("123456") where User='root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 3 Changed: 0 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> quit
Bye
[root@server ~]#
6. 서비스/서버를 중지했다가 다시 시작합니다. MySQL
service mysqld stop
service mysqld start
결과:
Starting MySQL: [ OK ]
아래 사진은 모든 것을 보여줍니다. 비밀번호 재설정 프로세스 사용자 사이트 “root” 서버의 MySQL.

이제 MySQL에 연결할 수 있습니다. phpmyadmin 예) 사용자와 함께 “뿌리”, 위에서 설정한 새 비밀번호를 사용합니다.
테스트된 튜토리얼 센토스 5.6 cu MySQL 버전 14.12 Distrib 5.0.77, readline 5.1을 사용하는 redhat-linux-gnu(i686)용.