[root@localhost /usr/local/mysql/data]# /etc/init.d/mysqld stop
Shutting down MySQL. [ OK ]
1.mysql 을 종료 한다.
[root@localhost /usr/local/mysql/data]# /usr/local/mysql/bin/mysqld_safe --skip-grant &
[2] 866
[1] Exit 127 /usr/bin/mysqld_safe --skip-grant
[root@localhost /usr/local/mysql/data]# 160125 15:21:09 mysqld_safe Logging to '/usr/local/mysql/data/localhost.localdomain.err'.
160125 15:21:10 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
2. mysql safe 모드로 실행 한다.
[root@localhost ~]# /usr/local/mysql/bin/mysql -u root mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.29-log Source distribution
Copyright (c) 2000, 2012, 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>
3. 다른 터미널로 접속 후 mysql을 접속 한다.
mysql> update user set password=password('변경할 패스워드') where user='root';
Query OK, 4 rows affected (0.01 sec)
Rows matched: 4 Changed: 4 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
4. 위 명령어를 이용하여 패스워드 초기화를 진행 후 mysql 재시작 한다.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.01 sec)
mysql>
mysql>
mysql> update user set password=password('변경할 패스워드') where user='root';
Query OK, 4 rows affected (0.01 sec)
Rows matched: 4 Changed: 4 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@localhost ~]#
'Mysql' 카테고리의 다른 글
[MySql] binlog 파일 sql 파일로 변환 쉘스크립트 (0) | 2016.09.11 |
---|---|
MySQL 5.7.9 설치시 참고해야할 사항 (2) | 2016.05.27 |
mysql 4.0 -> 5.5 DB 업그레이드 (1) | 2015.12.18 |
mysql5.5 넘어오면서 제거된 내용들 (0) | 2015.12.14 |
mysql 기본 명령어 및 수정 (0) | 2015.12.11 |