Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
Tags
- 유니티
- MS-SQL
- ASP
- sqlite
- MySQL
- PyQt
- python
- 함수
- 날짜
- mssql
- 맛집
- port
- 리눅스
- flutter
- Linux
- IOS
- node.js
- 다이어트
- ubuntu
- pandas
- swift
- Excel
- Unity
- PER
- 라즈베리파이
- PyQt5
- GIT
- javascript
- urllib
- tensorflow
Archives
아미(아름다운미소)
MySQL root 패스워드 분실시 본문
MySQL root 패스워드 분실시
1 mysqld 중지$ service mysqld stop Stopping MySQL: [ OK ]
- 인증 생략 옵션 + 안전모드로 데몬 실행
/usr/bin/mysqld_safe --skip-grant &
/usr/bin/mysqld_safe --skip-grant-tables &
$ /usr/bin/mysqld_safe --skip-grant-tables &→ 이제 패스워드 없이 mysql에 접속할 수 있게 되었습니다.
mysql 콘솔로 들어가서
다음 SQL 명령어를 입력하여 원하는 패스워드로 변경합니다.
/usr/bin/mysql -u root mysql
- 5.7 버전 미만
- 5.7 버전 이상
예)
4 mysqld 재시작
이제 패스워드를 입력해야만 mysql을 사용할 수 있도록 하기 위해, mysqld를 재시작한다.
UPDATE mysql.user SET password=PASSWORD('패스워드') WHERE user='root';
FLUSH PRIVILEGES;
quit
UPDATE mysql.user SET authentication_string=PASSWORD('패스워드') WHERE user='root';
FLUSH PRIVILEGES;
quit
$ /usr/bin/mysql -uroot mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
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> update user set password=password('P@ssw0rd') where user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql
$ service mysqld restart STOPPING server from pid file /var/run/mysqld/mysqld.pid 120229 13:08:54 mysqld ended Stopping MySQL: [ OK ] Starting MySQL: [ OK ] [1]+ Done /usr/bin/mysqld_safe --skip-grant→ 백그라운드로 실행 중이던 무인증 안전모드 mysqld 프로세스가 중지되고 정상모드 mysqld로 재시작되었습니다.
'데이타베이스 > MYSQL' 카테고리의 다른 글
| mysql charset 재정의 (0) | 2018.06.16 |
|---|---|
| mysql charset 체크 (0) | 2018.06.15 |
| [MySQL] mysql charset 변경하기 (0) | 2018.06.15 |
| [MySQL] auto_increment 값 초기화 및 재정렬 (0) | 2018.01.16 |
| mysql 포트변경 (0) | 2017.12.16 |
Comments