SQL 서버의 루트 암호를 복구하는 방법을 배우기 위한 단계별 자습서.
서버의 가장 중요한 사용자 MySQL의 확실히 사용자 "root". 이 사용자는 모든 것을 가지고 있습니다 관리 권한 (데이터베이스MySQL databases).
MySQL 루트 사용자의 암호를 더 이상 모르는 경우 몇 가지 간단한 단계에 따라 이 암호를 재설정해야 합니다.
튜토리얼은 서버용으로 제작되었습니다. MySQL 운영 체제에 설치 CentOS, 그러나 프로세스는 다른 배포판과 동일합니다. Linux.
SQL 서버의 루트 사용자 암호를 복구하는 방법
SQL 서버의 루트 사용자 암호를 복구하는 가장 간단한 방법은 다음과 같습니다. SSH (Secure Shell).
1. 사용자 "로 로그인합니다.root” MySQL 서버가 있는 시스템에. (MySQL 서버가 아닌 시스템의 루트 사용자). 콘솔에서 직접 또는 연결을 통해 원격으로 로그인 SSH (기준 퍼티 시스템에서 Windows).
2. 프로세스는 / MySQL을 중지합니다.
service mysqld stop
또는
/etc/init.d/mysqld stop
결과가 될 것입니다 :
Stopping MySQL: [ OK ]
3. " 옵션으로 MySQL 서버를 시작합니다.--skip-grant-tables
". MySQL 서버 시작/daemon 암호없이 처리하십시오.
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을 예) 위에서 설정한 새 암호를 사용하여 "루트" 사용자로.
자습서 테스트 CentOS 5.6 Redhat용 MySQL 버전 14.12 배포판 5.0.77 사용linux-gnu(i686) readline 5.1을 사용합니다.