컴퓨터활용/윈도우

윈도우용 MySQL 에서 root 비밀번호 분실시

멜번초이 2015. 2. 12. 16:27

내가 가지고 있는 개발환경은 mysql 5.6.21 버전이다.  오랫만에 다시 띄워서 써보려고 했더니 root 비밀번호가 생각이 나지 않는 것이었다. 그래서 찾아 보니 좋은 글이 있어서 참고했다. 

참조글 :  http://www.apmsetup.com/database.php?tutid=138&uid=291


C:\WINDOWS\system32>cd \opt\mysql-5.6.21-winx64


C:\opt\mysql-5.6.21-winx64>cd bin


C:\opt\mysql-5.6.21-winx64\bin>dir mysqld*

 Volume in drive C is OS

 Volume Serial Number is 8660-E798


 Directory of C:\opt\mysql-5.6.21-winx64\bin


2014-09-12  오전 01:29        33,238,528 mysqld-debug.exe

2014-09-12  오전 01:29        35,417,088 mysqld-debug.pdb

2014-09-12  오전 01:34        13,031,424 mysqld.exe

2014-09-12  오전 01:34        33,704,960 mysqld.pdb

2014-09-12  오전 01:33         4,815,872 mysqldump.exe

2014-09-12  오전 01:33         5,729,280 mysqldump.pdb

2014-09-12  오전 01:23             7,635 mysqldumpslow.pl

2014-09-12  오전 01:23            27,732 mysqld_multi.pl

               8 File(s)    125,972,519 bytes

               0 Dir(s)  13,951,184,896 bytes free


C:\opt\mysql-5.6.21-winx64\bin>mysqld.exe --skip-grant

2015-02-12 18:19:09 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for

timestamp server option (see documentation for more details).


C:\opt\mysql-5.6.21-winx64\bin>mysqld.exe --skip-grant  --explicit_defaults_for_timestamp


C:\opt\mysql-5.6.21-winx64\bin>mysql

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.6.21 MySQL Community Server (GPL)


Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> use mysql

Database changed

mysql> update user set password=password('black') where user='root';

Query OK, 3 rows affected (0.02 sec)

Rows matched: 3  Changed: 3  Warnings: 0


mysql> flush privileges;

Query OK, 0 rows affected (0.03 sec)


mysql>